launch user-installs automatically if they're present and the user consents
This commit is contained in:
@ -143,6 +143,17 @@ public class WindowsServiceUtil {
|
||||
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() {
|
||||
String programFiles = System.getenv("PROGRAMFILES");
|
||||
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
|
||||
return true;
|
||||
} else {
|
||||
// We can't just call `net start` or `sc start` directly, that throws
|
||||
// a permission error. We can start services.msc though, where the
|
||||
// user can start the service themselves. OR maybe we ask for
|
||||
// elevation here? May need to refactor Elevator and Shell32X to
|
||||
// achieve it though
|
||||
return false;
|
||||
try {
|
||||
Runtime.getRuntime().exec(getProgramFilesInstall());
|
||||
} catch (IOException e) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
Reference in New Issue
Block a user