Доделана очистка файлов пакета, после работы, вместе с jar.

This commit is contained in:
2023-10-26 21:40:37 +03:00
parent cd439030e8
commit 343c4fdcd2
4 changed files with 25 additions and 18 deletions

View File

@@ -1,4 +1,5 @@
package Visual_DVM_2021.Passes.All;
import Common.Constants;
import Common.Current;
import Common.Global;
import Common.Utils.Utils;
@@ -8,8 +9,11 @@ import SapforTestingSystem.SapforTasksPackage.SapforTasksPackage;
import TestingSystem.TasksPackage.TasksPackageState;
import Visual_DVM_2021.Passes.PassCode_2021;
import Visual_DVM_2021.Passes.TestingSystemPass;
import org.apache.commons.io.FileUtils;
import java.io.File;
import java.nio.file.Paths;
import java.util.Date;
public class DownloadSapforTasksPackage extends TestingSystemPass<SapforTasksPackage> {
@Override
public String getIconPath() {
@@ -20,12 +24,22 @@ public class DownloadSapforTasksPackage extends TestingSystemPass<SapforTasksPac
return "";
}
File tmpArchive = null;
File getLoaded() {
return Paths.get(Global.SapforPackagesDirectory.getAbsolutePath(), target.id, Constants.LOADED).toFile();
}
@Override
protected boolean canStart(Object... args) throws Exception {
if (Current.Check(Log, Current.SapforTasksPackage)) {
target = Current.getSapforTasksPackage();
if (target.state.equals(TasksPackageState.Done)) return true;
else Log.Writeln_("Пакет не завершен.");
if (!target.state.equals(TasksPackageState.Done)) {
Log.Writeln_("Пакет не завершен.");
return false;
}
if (getLoaded().exists()) {
System.out.println("Пакет уже загружен");
return false;
}
return true;
}
return false;
}
@@ -46,7 +60,10 @@ public class DownloadSapforTasksPackage extends TestingSystemPass<SapforTasksPac
if (passes.get(PassCode_2021.UnzipFolderPass).Do(
tmpArchive.getAbsolutePath(),
Global.SapforPackagesDirectory.getAbsolutePath(), false
)) ;
)) {
System.out.println("LOADED=" + Utils.Brackets(getLoaded().getAbsolutePath()));
FileUtils.writeStringToFile(getLoaded(), new Date().toString());
}
}
}