|
|
|
@ -65,9 +65,7 @@ public class I2PCommonBrowser {
|
|
|
|
|
*
|
|
|
|
|
* @return the properties of the object
|
|
|
|
|
*/
|
|
|
|
|
public Properties getProperties() {
|
|
|
|
|
return prop;
|
|
|
|
|
}
|
|
|
|
|
public Properties getProperties() { return prop; }
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Validates the user directory.
|
|
|
|
@ -311,7 +309,8 @@ public class I2PCommonBrowser {
|
|
|
|
|
protected String profileDir(String file, String browser, String base,
|
|
|
|
|
boolean app) {
|
|
|
|
|
String appString = app ? ".app" : "";
|
|
|
|
|
String profileDirName = String.format("i2p.%s.profile.%s%s", browser, base, appString);
|
|
|
|
|
String profileDirName =
|
|
|
|
|
String.format("i2p.%s.profile.%s%s", browser, base, appString);
|
|
|
|
|
File profileDir = new File(file, profileDirName);
|
|
|
|
|
return profileDir.getAbsolutePath();
|
|
|
|
|
}
|
|
|
|
@ -328,7 +327,8 @@ public class I2PCommonBrowser {
|
|
|
|
|
String base) {
|
|
|
|
|
logger.info("Unpacking base profile to " + profileDirectory);
|
|
|
|
|
try {
|
|
|
|
|
final InputStream resources = this.getClass().getClassLoader().getResourceAsStream(
|
|
|
|
|
final InputStream resources =
|
|
|
|
|
this.getClass().getClassLoader().getResourceAsStream(
|
|
|
|
|
"i2p." + browser + "." + base + ".profile.zip");
|
|
|
|
|
if (resources == null) {
|
|
|
|
|
logger.info("Could not find resources");
|
|
|
|
@ -475,9 +475,7 @@ public class I2PCommonBrowser {
|
|
|
|
|
* @return true if the proxy is ready, false if it is not.
|
|
|
|
|
* @since 0.0.1
|
|
|
|
|
*/
|
|
|
|
|
public boolean waitForProxy() {
|
|
|
|
|
return waitForProxy(CONFIGURED_TIMEOUT);
|
|
|
|
|
}
|
|
|
|
|
public boolean waitForProxy() { return waitForProxy(CONFIGURED_TIMEOUT); }
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Waits for an HTTP proxy on port 4444 to be ready.
|
|
|
|
@ -555,9 +553,7 @@ public class I2PCommonBrowser {
|
|
|
|
|
*
|
|
|
|
|
* @param time
|
|
|
|
|
*/
|
|
|
|
|
public void setProxyTimeoutTime(int time) {
|
|
|
|
|
CONFIGURED_TIMEOUT = time;
|
|
|
|
|
}
|
|
|
|
|
public void setProxyTimeoutTime(int time) { CONFIGURED_TIMEOUT = time; }
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Joins the elements of the given string array into a single string.
|
|
|
|
@ -594,6 +590,8 @@ public class I2PCommonBrowser {
|
|
|
|
|
* @return the found file or null if not found
|
|
|
|
|
*/
|
|
|
|
|
public File searchFile(File directory, String search) {
|
|
|
|
|
if (directory == null || !directory.exists() || !directory.canRead())
|
|
|
|
|
return null;
|
|
|
|
|
if (directory.isDirectory()) {
|
|
|
|
|
File[] files = directory.listFiles();
|
|
|
|
|
for (File file : files) {
|
|
|
|
@ -610,11 +608,16 @@ public class I2PCommonBrowser {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public File userHomeDir() {
|
|
|
|
|
File hd = new File(System.getProperty("user.dir"));
|
|
|
|
|
File rd = new File(System.getProperty("user.dir"));
|
|
|
|
|
File hd = new File(System.getProperty("user.home"));
|
|
|
|
|
if (rd == null || !rd.exists()) {
|
|
|
|
|
if (hd == null || !hd.exists()) {
|
|
|
|
|
hd = new File(System.getProperty("user.home"));
|
|
|
|
|
if (rd.getAbsolutePath().equals(hd.getAbsolutePath()))
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
logger.info("Runtime directory discovered at: "+ hd);
|
|
|
|
|
return hd;
|
|
|
|
|
return rd;
|
|
|
|
|
}
|
|
|
|
|
logger.info("Runtime directory discovered at: " + rd);
|
|
|
|
|
return rd;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|