diff --git a/src/compiler/csharp_generator_helpers.h b/src/compiler/csharp_generator_helpers.h index 13706276337..5639ea058b8 100644 --- a/src/compiler/csharp_generator_helpers.h +++ b/src/compiler/csharp_generator_helpers.h @@ -41,7 +41,7 @@ namespace grpc_csharp_generator { inline bool ServicesFilename(const grpc::protobuf::FileDescriptor *file, grpc::string *file_name_or_error) { - *file_name_or_error = grpc_generator::FileNameInUpperCamel(file) + "Grpc.cs"; + *file_name_or_error = grpc_generator::FileNameInUpperCamel(file, false) + "Grpc.cs"; return true; } diff --git a/src/compiler/generator_helpers.h b/src/compiler/generator_helpers.h index 68b807b0578..e1bb66a8753 100644 --- a/src/compiler/generator_helpers.h +++ b/src/compiler/generator_helpers.h @@ -125,16 +125,23 @@ inline grpc::string LowerUnderscoreToUpperCamel(grpc::string str) { return result; } -inline grpc::string FileNameInUpperCamel(const grpc::protobuf::FileDescriptor *file) { +inline grpc::string FileNameInUpperCamel(const grpc::protobuf::FileDescriptor *file, + bool include_package_path) { std::vector tokens = tokenize(StripProto(file->name()), "/"); grpc::string result = ""; - for (unsigned int i = 0; i < tokens.size() - 1; i++) { - result += tokens[i] + "/"; + if (include_package_path) { + for (unsigned int i = 0; i < tokens.size() - 1; i++) { + result += tokens[i] + "/"; + } } result += LowerUnderscoreToUpperCamel(tokens.back()); return result; } +inline grpc::string FileNameInUpperCamel(const grpc::protobuf::FileDescriptor *file) { + return FileNameInUpperCamel(file, true); +} + enum MethodType { METHODTYPE_NO_STREAMING, METHODTYPE_CLIENT_STREAMING,