aboutsummaryrefslogtreecommitdiff
path: root/src/ProtocolBuffers/Descriptors/FileDescriptor.cs
diff options
context:
space:
mode:
authorcsharptest <roger@csharptest.net>2012-10-14 23:03:24 -0500
committerrogerk <devnull@localhost>2012-10-14 23:03:24 -0500
commitc9bce45a01cc8861ec7c88e84d947ed6ebc8f7d1 (patch)
tree67b0bed46bb50ec47a383fc355db4a73d568b482 /src/ProtocolBuffers/Descriptors/FileDescriptor.cs
parent9f787cc64e47333ea717681c874843b44fee60e7 (diff)
downloadprotobuf-c9bce45a01cc8861ec7c88e84d947ed6ebc8f7d1.tar.gz
protobuf-c9bce45a01cc8861ec7c88e84d947ed6ebc8f7d1.tar.bz2
protobuf-c9bce45a01cc8861ec7c88e84d947ed6ebc8f7d1.zip
Portability Changes -
Removing uses of Enum to IConvertible from CodedIOStreams, Removed MessageStreamIterator.FromFile on non-client profiles, Removed use of Path.GetFileName, Removed uses of Converter<T1, T2> delegate, Removed Guid/DispId options from test protos
Diffstat (limited to 'src/ProtocolBuffers/Descriptors/FileDescriptor.cs')
-rw-r--r--src/ProtocolBuffers/Descriptors/FileDescriptor.cs4
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")
{