Script/server bin folder args

This commit is contained in:
Clisprail
2014-03-09 00:40:30 +01:00
parent 59f2df9086
commit 47ccd83249
2 changed files with 33 additions and 1 deletions
+8
View File
@@ -8,6 +8,8 @@ import org.parabot.core.ui.ServerSelector;
import org.parabot.core.ui.utils.UILog; import org.parabot.core.ui.utils.UILog;
import javax.swing.*; import javax.swing.*;
import java.io.File;
import java.io.IOException; import java.io.IOException;
/** /**
@@ -89,6 +91,12 @@ public final class Landing {
case "-dump": case "-dump":
Core.setDump(true); Core.setDump(true);
break; break;
case "-scriptsbin":
Directories.setScriptCompiledDirectory(new File(args[++i]));
break;
case "-serversbin":
Directories.setServerCompiledDirectory(new File(args[++i]));
break;
} }
} }
@@ -16,7 +16,7 @@ public class Directories {
private static Map<String, File> cached; private static Map<String, File> cached;
static { static {
cached = new HashMap<String, File>(); cached = new HashMap<String, File>();
switch (OperatingSystem.getOS()) { switch (OperatingSystem.getOS()) {
case WINDOWS: case WINDOWS:
cached.put("Root", new JFileChooser().getFileSystemView().getDefaultDirectory()); cached.put("Root", new JFileChooser().getFileSystemView().getDefaultDirectory());
@@ -36,6 +36,30 @@ public class Directories {
cached.put("Cache", new File(cached.get("Root"), "/Parabot/cache/")); cached.put("Cache", new File(cached.get("Root"), "/Parabot/cache/"));
Core.verbose("Directories cached."); Core.verbose("Directories cached.");
} }
/**
* Set script bin folder
* @param f
*/
public static void setScriptCompiledDirectory(File f) {
if(!f.isDirectory()) {
throw new IllegalArgumentException(f + "is not a directory.");
}
cached.put("Compiled", f);
}
/**
* Set server bin folder
* @param f
*/
public static void setServerCompiledDirectory(File f) {
if(!f.isDirectory()) {
throw new IllegalArgumentException(f + "is not a directory.");
}
cached.put("Servers", f);
}
/** /**
* Returns the root directory outside of the main Parabot folder. * Returns the root directory outside of the main Parabot folder.