diff options
Diffstat (limited to 'src/google/protobuf/compiler/csharp/csharp_generator.cc')
-rw-r--r-- | src/google/protobuf/compiler/csharp/csharp_generator.cc | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/google/protobuf/compiler/csharp/csharp_generator.cc b/src/google/protobuf/compiler/csharp/csharp_generator.cc index 2a416fac..e0a6c83a 100644 --- a/src/google/protobuf/compiler/csharp/csharp_generator.cc +++ b/src/google/protobuf/compiler/csharp/csharp_generator.cc @@ -50,7 +50,7 @@ namespace csharp { std::string GetOutputFile(const google::protobuf::FileDescriptor* file, const std::string file_extension) { - return GetFileUmbrellaClassname(file) + file_extension; + return GetUmbrellaClassUnqualifiedName(file) + file_extension; } void GenerateFile(const google::protobuf::FileDescriptor* file, @@ -68,6 +68,12 @@ bool Generator::Generate( vector<pair<string, string> > options; ParseGeneratorParameter(parameter, &options); + // We only support proto3 - but we make an exception for descriptor.proto. + if (file->syntax() != FileDescriptor::SYNTAX_PROTO3 && !IsDescriptorProto(file)) { + *error = "C# code generation only supports proto3 syntax"; + return false; + } + std::string file_extension = ".cs"; for (int i = 0; i < options.size(); i++) { if (options[i].first == "file_extension") { |