Fix parsing of arguments
This commit is contained in:
@@ -51,23 +51,25 @@ public class WinLauncher {
|
|||||||
boolean privateBrowsing = false;
|
boolean privateBrowsing = false;
|
||||||
boolean usabilityMode = false;
|
boolean usabilityMode = false;
|
||||||
boolean chromiumFirst = false;
|
boolean chromiumFirst = false;
|
||||||
|
ArrayList<String> newArgsList = new ArrayList<String>();
|
||||||
|
|
||||||
if (args != null) {
|
if (args != null) {
|
||||||
if (args.length > 0) {
|
if (args.length > 0) {
|
||||||
logger.info("checking for private browsing");
|
for (String arg : args) {
|
||||||
if (args[0].equals("-private")) {
|
if (arg.equals("-private")) {
|
||||||
privateBrowsing = true;
|
privateBrowsing = true;
|
||||||
logger.info(
|
logger.info(
|
||||||
"Private browsing is true, profile will be discarded at end of session.");
|
"Private browsing is true, profile will be discarded at end of session.");
|
||||||
}
|
} else if (arg.equals("-chromium")) {
|
||||||
if (args[0].equals("-chromium")) {
|
chromiumFirst = true;
|
||||||
chromiumFirst = true;
|
logger.info("Chromium will be selected before Firefox.");
|
||||||
logger.info("Chromium will be selected before Firefox.");
|
} else if (arg.equals("-usability")) {
|
||||||
}
|
usabilityMode = true;
|
||||||
if (args[0].equals("-usability")) {
|
logger.info(
|
||||||
usabilityMode = true;
|
"Usability mode is true, using alternate extensions loadout.");
|
||||||
logger.info(
|
} else {
|
||||||
"Usability mode is true, using alternate extensions loadout.");
|
newArgsList.add(arg);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -100,7 +102,7 @@ public class WinLauncher {
|
|||||||
i2pBrowser.firefox = !chromiumFirst;
|
i2pBrowser.firefox = !chromiumFirst;
|
||||||
i2pBrowser.chromium = chromiumFirst;
|
i2pBrowser.chromium = chromiumFirst;
|
||||||
System.out.println("I2PBrowser");
|
System.out.println("I2PBrowser");
|
||||||
i2pBrowser.launch(privateBrowsing);
|
i2pBrowser.launch(privateBrowsing, newArgsList.toArray());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -169,31 +171,29 @@ public class WinLauncher {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private static void setNotRunning() {
|
private static void setNotRunning() {
|
||||||
File home = selectHome();
|
File home = selectHome();
|
||||||
File running = new File(home, "running");
|
File running = new File(home, "running");
|
||||||
if (running.exists()){
|
if (running.exists()) {
|
||||||
running.delete();
|
running.delete();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private static void setRunning() {
|
private static void setRunning() {
|
||||||
File home = selectHome();
|
File home = selectHome();
|
||||||
File running = new File(home, "running");
|
File running = new File(home, "running");
|
||||||
if (!running.exists()){
|
if (!running.exists()) {
|
||||||
try{
|
try {
|
||||||
running.createNewFile();
|
running.createNewFile();
|
||||||
}catch(IOException e){
|
} catch (IOException e) {
|
||||||
logger.info(e.toString());
|
logger.info(e.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private static boolean i2pIsRunning() {
|
private static boolean i2pIsRunning() {
|
||||||
File home = selectHome();
|
File home = selectHome();
|
||||||
File running = new File(home, "running");
|
File running = new File(home, "running");
|
||||||
if (running.exists()){
|
if (running.exists()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
setRunning();
|
setRunning();
|
||||||
|
|||||||
Reference in New Issue
Block a user