Skip to content

Commit

Permalink
Made possible to provide an absolute data root path for start script
Browse files Browse the repository at this point in the history
Previously, only a path relative to the user home folder could be
provided
  • Loading branch information
luccioman committed Aug 30, 2018
1 parent bdd6ec3 commit c29588d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
18 changes: 15 additions & 3 deletions source/net/yacy/yacy.java
Expand Up @@ -789,14 +789,26 @@ public static void main(String args[]) {
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);
Expand Down Expand Up @@ -908,4 +920,4 @@ public void run() {
ConcurrentLog.severe("SHUTDOWN","Unexpected error. " + e.getClass().getName(),e);
}
}
}
}
2 changes: 1 addition & 1 deletion startYACY.sh
Expand Up @@ -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
Expand Down

0 comments on commit c29588d

Please sign in to comment.