Fix working directory which was still copied over from zab's
This commit is contained in:
@@ -19,10 +19,25 @@ class WinUpdateProcess implements Runnable {
|
|||||||
this.file = file;
|
this.file = file;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void runUpdateInstaller(File file){
|
private File workDir() throws IOException{
|
||||||
|
if (ctx != null) {
|
||||||
|
File workDir = new File(ctx.getConfigDir().getAbsolutePath(), "i2p_update_win");
|
||||||
|
if (workDir.exists()) {
|
||||||
|
if (workDir.isFile())
|
||||||
|
throw new IOException(workDir + " exists but is a file, get it out of the way");
|
||||||
|
return null;
|
||||||
|
} else {
|
||||||
|
workDir.mkdirs();
|
||||||
|
}
|
||||||
|
return workDir;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void runUpdateInstaller(File file) throws IOException {
|
||||||
String version = versionSupplier.get();
|
String version = versionSupplier.get();
|
||||||
|
|
||||||
var workingDir = new File(ctx.getConfigDir(), "mac_updates");
|
var workingDir = workDir();
|
||||||
var logFile = new File(workingDir, "log-" + version + ".txt");
|
var logFile = new File(workingDir, "log-" + version + ".txt");
|
||||||
|
|
||||||
ProcessBuilder pb = new ProcessBuilder(file.getAbsolutePath());
|
ProcessBuilder pb = new ProcessBuilder(file.getAbsolutePath());
|
||||||
@@ -47,6 +62,10 @@ class WinUpdateProcess implements Runnable {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
try {
|
||||||
runUpdateInstaller(file);
|
runUpdateInstaller(file);
|
||||||
|
} catch(IOException ioe) {
|
||||||
|
_log.error("Error running updater, update may fail.", ioe);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ public class WindowsUpdatePostProcessor implements UpdatePostProcessor {
|
|||||||
private File moveUpdateInstaller(File file) throws IOException{
|
private File moveUpdateInstaller(File file) throws IOException{
|
||||||
RouterContext i2pContext = i2pRouter.getContext();
|
RouterContext i2pContext = i2pRouter.getContext();
|
||||||
if (i2pContext != null) {
|
if (i2pContext != null) {
|
||||||
File appDir = i2pContext.getAppDir();
|
File appDir = i2pContext.getConfigDir();
|
||||||
File newFile = new File(workDir(), file.getName());
|
File newFile = new File(workDir(), file.getName());
|
||||||
file.renameTo(newFile);
|
file.renameTo(newFile);
|
||||||
return newFile;
|
return newFile;
|
||||||
@@ -78,7 +78,7 @@ public class WindowsUpdatePostProcessor implements UpdatePostProcessor {
|
|||||||
private File workDir() throws IOException{
|
private File workDir() throws IOException{
|
||||||
RouterContext i2pContext = i2pRouter.getContext();
|
RouterContext i2pContext = i2pRouter.getContext();
|
||||||
if (i2pContext != null) {
|
if (i2pContext != null) {
|
||||||
File workDir = new File(i2pContext.getAppDir().getAbsolutePath(), "i2p_update_win");
|
File workDir = new File(i2pContext.getConfigDir().getAbsolutePath(), "i2p_update_win");
|
||||||
if (workDir.exists()) {
|
if (workDir.exists()) {
|
||||||
if (workDir.isFile())
|
if (workDir.isFile())
|
||||||
throw new IOException(workDir + " exists but is a file, get it out of the way");
|
throw new IOException(workDir + " exists but is a file, get it out of the way");
|
||||||
@@ -96,12 +96,12 @@ public class WindowsUpdatePostProcessor implements UpdatePostProcessor {
|
|||||||
if (SystemVersion.isWindows()) {
|
if (SystemVersion.isWindows()) {
|
||||||
File jrehome = new File(System.getProperty("java.home"));
|
File jrehome = new File(System.getProperty("java.home"));
|
||||||
File programs = jrehome.getParentFile();
|
File programs = jrehome.getParentFile();
|
||||||
System.out.println("Windows portable jpackage wrapper started, using: " + programs + " as working config");
|
System.out.println("Windows portable jpackage wrapper found, using: " + programs + " as working config");
|
||||||
return programs.getAbsoluteFile();
|
return programs.getAbsoluteFile();
|
||||||
} else {
|
} else {
|
||||||
File jrehome = new File(System.getProperty("java.home"));
|
File jrehome = new File(System.getProperty("java.home"));
|
||||||
File programs = new File(jrehome.getParentFile().getParentFile(), "i2p");
|
File programs = new File(jrehome.getParentFile().getParentFile(), "i2p");
|
||||||
System.out.println("Linux portable jpackage wrapper started, using: " + programs + " as working config");
|
System.out.println("Linux portable jpackage wrapper found, using: " + programs + " as working config");
|
||||||
return programs.getAbsoluteFile();
|
return programs.getAbsoluteFile();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -203,7 +203,6 @@ Function routerDetect
|
|||||||
File /nonfatal "I2P\config\wrapper.config"
|
File /nonfatal "I2P\config\wrapper.config"
|
||||||
File /nonfatal "I2P\config\hosts.txt"
|
File /nonfatal "I2P\config\hosts.txt"
|
||||||
|
|
||||||
|
|
||||||
createDirectory "$I2PINSTEXE\webapps\"
|
createDirectory "$I2PINSTEXE\webapps\"
|
||||||
SetOutPath "$I2PINSTEXE\webapps\"
|
SetOutPath "$I2PINSTEXE\webapps\"
|
||||||
File /nonfatal /a /r "I2P\config\webapps\"
|
File /nonfatal /a /r "I2P\config\webapps\"
|
||||||
@@ -286,10 +285,6 @@ Section Install
|
|||||||
${EndIf}
|
${EndIf}
|
||||||
${EndIf}
|
${EndIf}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Install the launcher scripts
|
# Install the launcher scripts
|
||||||
createDirectory "$INSTDIR\licenses"
|
createDirectory "$INSTDIR\licenses"
|
||||||
SetOutPath "$INSTDIR"
|
SetOutPath "$INSTDIR"
|
||||||
|
|||||||
Reference in New Issue
Block a user