launch user-installs automatically if they're present and the user consents
This commit is contained in:
@@ -96,8 +96,7 @@ public class WinLauncher extends CopyConfigDir {
|
|||||||
}
|
}
|
||||||
continuerunning = promptUserInstallStartIfAvailable();
|
continuerunning = promptUserInstallStartIfAvailable();
|
||||||
if (!continuerunning) {
|
if (!continuerunning) {
|
||||||
logger.severe(
|
logger.severe("User-install startup required.");
|
||||||
"User-install startup required.");
|
|
||||||
System.exit(2);
|
System.exit(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -143,6 +143,17 @@ public class WindowsServiceUtil {
|
|||||||
return "http://tc73n4kivdroccekirco7rhgxdg5f3cjvbaapabupeyzrqwv5guq.b32.i2p/news.su3";
|
return "http://tc73n4kivdroccekirco7rhgxdg5f3cjvbaapabupeyzrqwv5guq.b32.i2p/news.su3";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String getProgramFilesInstall() {
|
||||||
|
String programFiles = System.getenv("PROGRAMFILES");
|
||||||
|
File programFilesI2P = new File(programFiles, "i2p/i2p.exe");
|
||||||
|
if (programFilesI2P.exists())
|
||||||
|
return programFilesI2P.getAbsolutePath();
|
||||||
|
String programFiles86 = System.getenv("PROGRAMFILES86");
|
||||||
|
File programFiles86I2P = new File(programFiles86, "i2p/i2p.exe");
|
||||||
|
if (programFiles86I2P.exists())
|
||||||
|
return programFiles86I2P.getAbsolutePath();
|
||||||
|
}
|
||||||
|
|
||||||
public static boolean checkProgramFilesInstall() {
|
public static boolean checkProgramFilesInstall() {
|
||||||
String programFiles = System.getenv("PROGRAMFILES");
|
String programFiles = System.getenv("PROGRAMFILES");
|
||||||
File programFilesI2P = new File(programFiles, "i2p/i2p.exe");
|
File programFilesI2P = new File(programFiles, "i2p/i2p.exe");
|
||||||
@@ -174,12 +185,12 @@ public class WindowsServiceUtil {
|
|||||||
// Do nothing here, this will continue on to launch a jpackaged router
|
// Do nothing here, this will continue on to launch a jpackaged router
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
// We can't just call `net start` or `sc start` directly, that throws
|
try {
|
||||||
// a permission error. We can start services.msc though, where the
|
Runtime.getRuntime().exec(getProgramFilesInstall());
|
||||||
// user can start the service themselves. OR maybe we ask for
|
} catch (IOException e) {
|
||||||
// elevation here? May need to refactor Elevator and Shell32X to
|
return false;
|
||||||
// achieve it though
|
}
|
||||||
return false;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
Reference in New Issue
Block a user