diff options
Diffstat (limited to 'src/ProtocolBuffers/Descriptors/FileDescriptor.cs')
-rw-r--r-- | src/ProtocolBuffers/Descriptors/FileDescriptor.cs | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/ProtocolBuffers/Descriptors/FileDescriptor.cs b/src/ProtocolBuffers/Descriptors/FileDescriptor.cs index 392db9a7..d7075e35 100644 --- a/src/ProtocolBuffers/Descriptors/FileDescriptor.cs +++ b/src/ProtocolBuffers/Descriptors/FileDescriptor.cs @@ -90,12 +90,14 @@ namespace Google.ProtocolBuffers.Descriptors csharpFileOptions = BuildOrFakeWithDefaultOptions(options);
}
+ static readonly char[] PathSeperators = new char[] { '/', '\\' };
private CSharpFileOptions BuildOrFakeWithDefaultOptions(CSharpFileOptions defaultOptions)
{
// Fix for being able to relocate these files to any directory structure
if (proto.Package == "google.protobuf")
{
- string filename = Path.GetFileName(proto.Name);
+ int ixslash = proto.Name.LastIndexOfAny(PathSeperators);
+ string filename = ixslash < 0 ? proto.Name : proto.Name.Substring(ixslash + 1);
// TODO(jonskeet): Check if we could use FileDescriptorProto.Descriptor.Name - interesting bootstrap issues)
if (filename == "descriptor.proto")
{
|