Split the Makefile up into a bunch of categorized sub-files.

This commit is contained in:
idk
2022-02-09 21:43:30 -05:00
parent 34197f013d
commit 56a83972e4
15 changed files with 371 additions and 324 deletions

View File

@ -11,20 +11,20 @@ class WinUpdateProcess implements Runnable {
private final RouterContext ctx;
private final Supplier<String> versionSupplier;
private final Supplier<File> fileSupplier;
WinUpdateProcess(RouterContext ctx, Supplier<String> versionSupplier, Supplier<File> fileSupplier) {
this.ctx = ctx;
this.versionSupplier = versionSupplier;
this.fileSupplier = fileSupplier;
}
private File workDir() throws IOException{
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;
return null;
} else {
workDir.mkdirs();
}
@ -35,9 +35,9 @@ class WinUpdateProcess implements Runnable {
private void runUpdateInstaller() throws IOException {
String version = versionSupplier.get();
File file = fileSupplier.get();
if (file == null)
return;
File file = fileSupplier.get();
if (file == null)
return;
var workingDir = workDir();
var logFile = new File(workingDir, "log-" + version + ".txt");
@ -52,12 +52,9 @@ class WinUpdateProcess implements Runnable {
env.put("RESTART_I2P", "true");
try {
pb.directory(workingDir).
redirectErrorStream(true).
redirectOutput(logFile).
start();
pb.directory(workingDir).redirectErrorStream(true).redirectOutput(logFile).start();
} catch (IOException ex) {
System.out.println("Unable to run update-program in background. Update will fail.");
System.out.println("Unable to run update-program in background. Update will fail.");
}
}
@ -65,7 +62,7 @@ class WinUpdateProcess implements Runnable {
public void run() {
try {
runUpdateInstaller();
} catch(IOException ioe) {
} catch (IOException ioe) {
System.out.println("Error running updater, update may fail." + ioe);
}
}