File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed
src/main/java/org/scijava/launcher Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -325,6 +325,19 @@ public static void upgrade(BiConsumer<String, Double> subscriber)
325325 String configFileValue = System .getProperty ("scijava.app.config-file" );
326326 if (configFileValue != null && !configFileValue .isEmpty ()) {
327327 File configFile = new File (configFileValue );
328+ String appDirValue = System .getProperty ("scijava.app.directory" );
329+ if (appDirValue != null ) {
330+ Path appDirPath = Paths .get (appDirValue ).normalize ().toAbsolutePath ();
331+ // If possible, use a path relative to the application directory.
332+ // This improves portability if the application gets moved
333+ // elsewhere, and/or accessed from multiple operating systems.
334+ try {
335+ newJavaPath = appDirPath .relativize (newJavaPath );
336+ }
337+ catch (IllegalArgumentException exc ) {
338+ Log .debug (exc );
339+ }
340+ }
328341 Config .update (configFile , "jvm.dir" , newJavaPath .toString ());
329342 }
330343 }
You can’t perform that action at this time.
0 commit comments