Fixed detection of absolute data folder path on MS Windows

pull/258/head
luccioman 6 years ago
parent 595e144797
commit 7dc1f60619

@ -790,10 +790,8 @@ public final class yacy {
if ((args.length >= 1) && (args[0].toLowerCase(Locale.ROOT).equals("-startup") || args[0].equals("-start"))) { if ((args.length >= 1) && (args[0].toLowerCase(Locale.ROOT).equals("-startup") || args[0].equals("-start"))) {
// normal start-up of yacy // normal start-up of yacy
if (args.length > 1) { if (args.length > 1) {
if(args[1].startsWith(File.separator)) { dataRoot = new File(args[1]);
/* data root folder provided as an absolute path */ if(!dataRoot.isAbsolute()) {
dataRoot = new File(args[1]);
} else {
/* data root folder provided as a path relative to the user home folder */ /* data root folder provided as a path relative to the user home folder */
dataRoot = new File(System.getProperty("user.home").replace('\\', '/'), args[1]); dataRoot = new File(System.getProperty("user.home").replace('\\', '/'), args[1]);
} }
@ -803,10 +801,8 @@ public final class yacy {
} else if (args.length >= 1 && args[0].toLowerCase(Locale.ROOT).equals("-gui")) { } else if (args.length >= 1 && args[0].toLowerCase(Locale.ROOT).equals("-gui")) {
// start-up of yacy with gui // start-up of yacy with gui
if (args.length > 1) { if (args.length > 1) {
if(args[1].startsWith(File.separator)) { dataRoot = new File(args[1]);
/* data root folder provided as an absolute path */ if(!dataRoot.isAbsolute()) {
dataRoot = new File(args[1]);
} else {
/* data root folder provided as a path relative to the user home folder */ /* data root folder provided as a path relative to the user home folder */
dataRoot = new File(System.getProperty("user.home").replace('\\', '/'), args[1]); dataRoot = new File(System.getProperty("user.home").replace('\\', '/'), args[1]);
} }

Loading…
Cancel
Save