mirror of
https://github.com/GravitLauncher/Launcher
synced 2025-01-03 22:30:31 +03:00
Delete temp files mode.
This commit is contained in:
parent
a238f79fe6
commit
5ba69c155a
3 changed files with 9 additions and 5 deletions
|
@ -140,7 +140,8 @@ public static final class Config {
|
||||||
public boolean isWarningMissArchJava;
|
public boolean isWarningMissArchJava;
|
||||||
public boolean enabledProGuard;
|
public boolean enabledProGuard;
|
||||||
public boolean stripLineNumbers;
|
public boolean stripLineNumbers;
|
||||||
|
public boolean deleteTempFiles;
|
||||||
|
|
||||||
public String startScript;
|
public String startScript;
|
||||||
|
|
||||||
|
|
||||||
|
@ -576,9 +577,11 @@ private void generateConfigIfNotExists() throws IOException {
|
||||||
newConfig.whitelistRejectString = "Вас нет в белом списке";
|
newConfig.whitelistRejectString = "Вас нет в белом списке";
|
||||||
|
|
||||||
newConfig.threadCoreCount = 0; // on your own
|
newConfig.threadCoreCount = 0; // on your own
|
||||||
|
newConfig.threadCount = JVMHelper.OPERATING_SYSTEM_MXBEAN.getAvailableProcessors() >= 4 ? JVMHelper.OPERATING_SYSTEM_MXBEAN.getAvailableProcessors() / 2 : JVMHelper.OPERATING_SYSTEM_MXBEAN.getAvailableProcessors();
|
||||||
|
|
||||||
newConfig.enabledProGuard = true;
|
newConfig.enabledProGuard = true;
|
||||||
newConfig.stripLineNumbers = false;
|
newConfig.stripLineNumbers = false;
|
||||||
newConfig.threadCount = JVMHelper.OPERATING_SYSTEM_MXBEAN.getAvailableProcessors() >= 4 ? JVMHelper.OPERATING_SYSTEM_MXBEAN.getAvailableProcessors() / 2 : JVMHelper.OPERATING_SYSTEM_MXBEAN.getAvailableProcessors();
|
newConfig.deleteTempFiles = false;
|
||||||
// Set server address
|
// Set server address
|
||||||
LogHelper.println("LaunchServer address: ");
|
LogHelper.println("LaunchServer address: ");
|
||||||
newConfig.setAddress(commandHandler.readLine());
|
newConfig.setAddress(commandHandler.readLine());
|
||||||
|
|
|
@ -54,12 +54,13 @@ public void build() throws IOException {
|
||||||
long time_task_end = System.currentTimeMillis();
|
long time_task_end = System.currentTimeMillis();
|
||||||
long time_task = time_task_end - time_this;
|
long time_task = time_task_end - time_this;
|
||||||
time_this = time_task_end;
|
time_this = time_task_end;
|
||||||
if (isNeedDelete) Files.delete(oldPath);
|
if (isNeedDelete && server.config.deleteTempFiles) Files.delete(oldPath);
|
||||||
isNeedDelete = task.allowDelete();
|
isNeedDelete = task.allowDelete();
|
||||||
LogHelper.subInfo("Task %s processed from %d millis",task.getName(), time_task);
|
LogHelper.subInfo("Task %s processed from %d millis",task.getName(), time_task);
|
||||||
}
|
}
|
||||||
long time_end = System.currentTimeMillis();
|
long time_end = System.currentTimeMillis();
|
||||||
IOHelper.move(thisPath, syncBinaryFile);
|
if (isNeedDelete && server.config.deleteTempFiles) IOHelper.move(thisPath, syncBinaryFile);
|
||||||
|
else IOHelper.copy(thisPath, syncBinaryFile);
|
||||||
LogHelper.info("Build successful from %d millis",time_end - time_start);
|
LogHelper.info("Build successful from %d millis",time_end - time_start);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -51,7 +51,7 @@ private void attach(ZipOutputStream output) throws IOException {
|
||||||
ZipEntry e = input.getNextEntry();
|
ZipEntry e = input.getNextEntry();
|
||||||
while (e != null) {
|
while (e != null) {
|
||||||
String filename = e.getName();
|
String filename = e.getName();
|
||||||
if (exclusions.stream().noneMatch(exc -> filename.startsWith(exc))) {
|
if (exclusions.stream().noneMatch(filename::startsWith)) {
|
||||||
output.putNextEntry(IOHelper.newZipEntry(e));
|
output.putNextEntry(IOHelper.newZipEntry(e));
|
||||||
IOHelper.transfer(input, output);
|
IOHelper.transfer(input, output);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue