File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed
plugin/src/main/java/com/flit/protoc/gen/server Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change 33import com .google .protobuf .DescriptorProtos ;
44import com .squareup .javapoet .ClassName ;
55
6+ import java .io .File ;
67import java .util .HashMap ;
78import java .util .List ;
89import java .util .Map ;
@@ -34,7 +35,8 @@ public static String getClassname(DescriptorProtos.FileDescriptorProto proto) {
3435
3536 if (clazz == null || clazz .isEmpty ()) {
3637
37- char [] classname = proto .getName ().substring (0 , proto .getName ().lastIndexOf ('.' )).toCharArray ();
38+ String basename = new File (proto .getName ()).getName ();
39+ char [] classname = basename .substring (0 , basename .lastIndexOf ('.' )).toCharArray ();
3840 StringBuilder sb = new StringBuilder ();
3941
4042 char previous = '_' ;
@@ -70,7 +72,7 @@ public static String getClassname(DescriptorProtos.FileDescriptorProto proto) {
7072 }
7173 }
7274
73- return clazz ;
75+ return String . join ( "." , proto . getOptions (). getJavaPackage (), clazz ) ;
7476 }
7577
7678}
You can’t perform that action at this time.
0 commit comments