mirror of
https://github.com/GravitLauncher/Launcher
synced 2024-12-31 20:59:54 +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 enabledProGuard;
|
||||
public boolean stripLineNumbers;
|
||||
|
||||
public boolean deleteTempFiles;
|
||||
|
||||
public String startScript;
|
||||
|
||||
|
||||
|
@ -576,9 +577,11 @@ private void generateConfigIfNotExists() throws IOException {
|
|||
newConfig.whitelistRejectString = "Вас нет в белом списке";
|
||||
|
||||
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.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
|
||||
LogHelper.println("LaunchServer address: ");
|
||||
newConfig.setAddress(commandHandler.readLine());
|
||||
|
|
|
@ -54,12 +54,13 @@ public void build() throws IOException {
|
|||
long time_task_end = System.currentTimeMillis();
|
||||
long time_task = time_task_end - time_this;
|
||||
time_this = time_task_end;
|
||||
if (isNeedDelete) Files.delete(oldPath);
|
||||
if (isNeedDelete && server.config.deleteTempFiles) Files.delete(oldPath);
|
||||
isNeedDelete = task.allowDelete();
|
||||
LogHelper.subInfo("Task %s processed from %d millis",task.getName(), time_task);
|
||||
}
|
||||
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);
|
||||
}
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@ private void attach(ZipOutputStream output) throws IOException {
|
|||
ZipEntry e = input.getNextEntry();
|
||||
while (e != null) {
|
||||
String filename = e.getName();
|
||||
if (exclusions.stream().noneMatch(exc -> filename.startsWith(exc))) {
|
||||
if (exclusions.stream().noneMatch(filename::startsWith)) {
|
||||
output.putNextEntry(IOHelper.newZipEntry(e));
|
||||
IOHelper.transfer(input, output);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue