Skip to content

Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance

Made possible to provide an absolute data root path for start script

lucciomanc29588dd6add
diff --git a/source/net/yacy/yacy.java b/source/net/yacy/yacy.java
index 1a0661181..f30349335 100644
--- a/source/net/yacy/yacy.java
+++ b/source/net/yacy/yacy.java
@@ -789,14 +789,26 @@ public final class yacy {
if ((args.length >= 1) && (args[0].toLowerCase(Locale.ROOT).equals("-startup") || args[0].equals("-start"))) {
// normal start-up of yacy
if (args.length > 1) {
- dataRoot = new File(System.getProperty("user.home").replace('\\', '/'), args[1]);
+ if(args[1].startsWith(File.separator)) {
+ /* data root folder provided as an absolute path */
+ dataRoot = new File(args[1]);
+ } else {
+ /* data root folder provided as a path relative to the user home folder */
+ dataRoot = new File(System.getProperty("user.home").replace('\\', '/'), args[1]);
+ }
}
preReadSavedConfigandInit(dataRoot);
startup(dataRoot, applicationRoot, startupMemFree, startupMemTotal, false);
} else if (args.length >= 1 && args[0].toLowerCase(Locale.ROOT).equals("-gui")) {
// start-up of yacy with gui
if (args.length > 1) {
- dataRoot = new File(System.getProperty("user.home").replace('\\', '/'), args[1]);
+ if(args[1].startsWith(File.separator)) {
+ /* data root folder provided as an absolute path */
+ dataRoot = new File(args[1]);
+ } else {
+ /* data root folder provided as a path relative to the user home folder */
+ dataRoot = new File(System.getProperty("user.home").replace('\\', '/'), args[1]);
+ }
}
preReadSavedConfigandInit(dataRoot);
startup(dataRoot, applicationRoot, startupMemFree, startupMemTotal, true);
@@ -908,4 +920,4 @@ class shutdownHookThread extends Thread {
ConcurrentLog.severe("SHUTDOWN","Unexpected error. " + e.getClass().getName(),e);
}
}
-}
+}
\ No newline at end of file
diff --git a/startYACY.sh b/startYACY.sh
index a6ebf88e2..6e9101030 100755
--- a/startYACY.sh
+++ b/startYACY.sh
@@ -58,7 +58,7 @@ then
options="`getopt hdlptsg: $*`"
else
- options="`getopt -n YaCy -o h,d,f,l,p,t,s,g -l help,debug,foreground,logging,print-out,tail-log,startup,gui -- $@`"
+ options="`getopt -u -n YaCy -o h,d,f,l,p,t,s,g -l help,debug,foreground,logging,print-out,tail-log,startup,gui -- $@`"
fi
if [ $? -ne 0 ];then