Commit efba5cd4 authored by Markus Philipp Bauer's avatar Markus Philipp Bauer

windows fix for path

parent ba630afb
Pipeline #142362 canceled with stage
in 3 seconds
......@@ -30,13 +30,16 @@ public class Util {
String jarPath = MapService.class.getResource("/").getPath()
.replaceAll("^.*file:", "")
.replaceAll("jar!.*", "jar");
if (jarPath.indexOf("/")==0){
jarPath = jarPath.substring(1);
}
if(jarPath.contains("test-classes")){
return Paths.get(jarPath).getParent().toString() + "/test-classes";
return Paths.get(Paths.get(jarPath).getParent().toString(), "test-classes").toString();
}
return Paths.get(jarPath).getParent().toString() + "/classes";
return Paths.get(Paths.get(jarPath).getParent().toString(), "classes").toString();
}
public static String getDatabasePath(){
return "jdbc:sqlite:" + getWorkDir() + "/app.db";
return "jdbc:sqlite:" + Paths.get(getWorkDir(), "app.db").toString();
}
}
......@@ -46,13 +46,16 @@ public class Utils {
}
public static String getWorkDir(){
String jarPath = Utils.class.getResource("/").getPath()
String jarPath = RpcServer.class.getResource("/").getPath()
.replaceAll("^.*file:", "")
.replaceAll("jar!.*", "jar");
if (jarPath.indexOf("/")==0){
jarPath = jarPath.substring(1);
}
if(jarPath.contains("test-classes")){
return Paths.get(jarPath).getParent().toString() + "/test-classes";
return Paths.get(Paths.get(jarPath).getParent().toString(), "test-classes").toString();
}
return Paths.get(jarPath).getParent().toString() + "/classes";
return Paths.get(Paths.get(jarPath).getParent().toString(), "classes").toString();
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment