File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed
src/ServiceStackIDEA/src/main/java/net/servicestack/idea Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -67,9 +67,9 @@ public static void updateServiceStackReference(PsiFile psiFile) {
6767
6868 String existingPath = builder .getPath ();
6969 if (existingPath == null || existingPath .equals ("/" )) {
70- builder .setPath ("/" + nativeTypesHandler .getRelativeTypesUrl ());
70+ builder .setPath (combinePath ( "" , nativeTypesHandler .getRelativeTypesUrl () ));
7171 } else {
72- builder .setPath (existingPath + "/" + nativeTypesHandler .getRelativeTypesUrl ());
72+ builder .setPath (combinePath ( existingPath , nativeTypesHandler .getRelativeTypesUrl () ));
7373 }
7474
7575 Map <String ,String > options = new HashMap <String ,String >();
@@ -134,6 +134,18 @@ public static void updateServiceStackReference(PsiFile psiFile) {
134134 }
135135 }
136136
137+ public static String combinePath (String path , String segment ) {
138+ if (path == null || path .isEmpty ()) {
139+ return "/" + segment ;
140+ }
141+
142+ if (path .charAt (path .length () - 1 ) == '/' ) {
143+ return path + segment ;
144+ }
145+
146+ return path + "/" + segment ;
147+ }
148+
137149 public static boolean containsOptionsHeader (PsiFile psiJavaFile ) {
138150 Document dtoDocument = FileDocumentManager .getInstance ().getDocument (psiJavaFile .getVirtualFile ());
139151 if (dtoDocument == null ) {
You can’t perform that action at this time.
0 commit comments