change message
This commit is contained in:
@@ -12,7 +12,7 @@ import java.util.logging.FileHandler;
|
|||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
import java.util.logging.SimpleFormatter;
|
import java.util.logging.SimpleFormatter;
|
||||||
|
|
||||||
public class CopyConfigDir {
|
public class CopyConfigDir extends WindowsServiceUtil {
|
||||||
static final Logger logger = Logger.getLogger("configlog");
|
static final Logger logger = Logger.getLogger("configlog");
|
||||||
|
|
||||||
public static void initLogger() {
|
public static void initLogger() {
|
||||||
@@ -152,20 +152,6 @@ public class CopyConfigDir {
|
|||||||
return i2p;
|
return i2p;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* get the OS name(windows, mac, linux only)
|
|
||||||
*
|
|
||||||
* @return os name in lower-case, "windows" "mac" or "linux"
|
|
||||||
*/
|
|
||||||
protected static String osName() {
|
|
||||||
String osName = System.getProperty("os.name").toLowerCase();
|
|
||||||
if (osName.contains("windows"))
|
|
||||||
return "windows";
|
|
||||||
if (osName.contains("mac"))
|
|
||||||
return "mac";
|
|
||||||
return "linux";
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get the path to the java home, for jpackage this is related to the
|
* get the path to the java home, for jpackage this is related to the
|
||||||
* executable itself, which is handy to know. It's a directory called runtime,
|
* executable itself, which is handy to know. It's a directory called runtime,
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ public class WinLauncher extends CopyConfigDir {
|
|||||||
static WindowsUpdatePostProcessor wupp = null;
|
static WindowsUpdatePostProcessor wupp = null;
|
||||||
private static Router i2pRouter;
|
private static Router i2pRouter;
|
||||||
|
|
||||||
public static void main(String[] args) throws Exception {
|
public static void main(String[] args) {
|
||||||
setupLauncher();
|
setupLauncher();
|
||||||
initLogger();
|
initLogger();
|
||||||
boolean privateBrowsing = false;
|
boolean privateBrowsing = false;
|
||||||
@@ -88,6 +88,12 @@ public class WinLauncher extends CopyConfigDir {
|
|||||||
File programs = programFile();
|
File programs = programFile();
|
||||||
File home = homeDir();
|
File home = homeDir();
|
||||||
|
|
||||||
|
boolean continuerunning = promptServiceStartIfAvailable("i2p");
|
||||||
|
if (!continuerunning){
|
||||||
|
logger.severe("Service startup failure, please start I2P service with services.msc");
|
||||||
|
System.exit(2);
|
||||||
|
}
|
||||||
|
|
||||||
// This actually does most of what we use NSIS for if NSIS hasn't
|
// This actually does most of what we use NSIS for if NSIS hasn't
|
||||||
// already done it, which essentially makes this whole thing portable.
|
// already done it, which essentially makes this whole thing portable.
|
||||||
if (!copyConfigDir()) {
|
if (!copyConfigDir()) {
|
||||||
|
|||||||
@@ -105,19 +105,23 @@ public class WindowsServiceUtil {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void promptServiceStartIfAvailable(String serviceName) {
|
public static boolean promptServiceStartIfAvailable(String serviceName) {
|
||||||
|
if (osName() != "windows"){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
if (isInstalled(serviceName)) {
|
if (isInstalled(serviceName)) {
|
||||||
if (!isStart(serviceName)) {
|
if (!isStart(serviceName)) {
|
||||||
int a;
|
int a;
|
||||||
String message =
|
String message =
|
||||||
"It appears you have an existing I2P service installed.\n";
|
"It appears you have an existing I2P service installed.\n";
|
||||||
message +=
|
message +=
|
||||||
"However, it is not running yet. Would you like to start it?\n";
|
"However, it is not running yet. Please start it through `services.msc`.\n";
|
||||||
a = JOptionPane.showConfirmDialog(null, message,
|
a = JOptionPane.showConfirmDialog(null, message,
|
||||||
"I2P Service detected not running",
|
"I2P Service detected not running",
|
||||||
JOptionPane.YES_NO_OPTION);
|
JOptionPane.YES_NO_OPTION);
|
||||||
if (a == JOptionPane.NO_OPTION) {
|
if (a == JOptionPane.NO_OPTION) {
|
||||||
// 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;
|
||||||
} else {
|
} else {
|
||||||
// We can't just call `net start` or `sc start` directly, that throws
|
// We can't just call `net start` or `sc start` directly, that throws
|
||||||
// a permission error. We can start services.msc though, where the
|
// a permission error. We can start services.msc though, where the
|
||||||
@@ -125,11 +129,11 @@ public class WindowsServiceUtil {
|
|||||||
// elevation here? May need to refactor Elevator and Shell32X to
|
// elevation here? May need to refactor Elevator and Shell32X to
|
||||||
// achieve it though
|
// achieve it though
|
||||||
}
|
}
|
||||||
} else {
|
return isStart("i2p");
|
||||||
// Here, the service is already started, so I2P should appear to be
|
|
||||||
// running to the other checks.
|
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getServiceState(String serviceName) {
|
public static String getServiceState(String serviceName) {
|
||||||
@@ -160,6 +164,20 @@ public class WindowsServiceUtil {
|
|||||||
}
|
}
|
||||||
return stateString;
|
return stateString;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* get the OS name(windows, mac, linux only)
|
||||||
|
*
|
||||||
|
* @return os name in lower-case, "windows" "mac" or "linux"
|
||||||
|
*/
|
||||||
|
protected static String osName() {
|
||||||
|
String osName = System.getProperty("os.name").toLowerCase();
|
||||||
|
if (osName.contains("windows"))
|
||||||
|
return "windows";
|
||||||
|
if (osName.contains("mac"))
|
||||||
|
return "mac";
|
||||||
|
return "linux";
|
||||||
|
}
|
||||||
public static void main(String args[]) {
|
public static void main(String args[]) {
|
||||||
// when querying the I2P router service installed by the IzPack installer
|
// when querying the I2P router service installed by the IzPack installer
|
||||||
// this is the correct call.
|
// this is the correct call.
|
||||||
|
|||||||
Reference in New Issue
Block a user