add detection for developement environment

This commit is contained in:
HorizonCode 2022-07-04 10:50:39 +02:00
parent c6eb4c8fdb
commit e5abc4823d
3 changed files with 7 additions and 3 deletions

View File

@ -7,12 +7,18 @@ public class Bootstrapper {
public static void main(String[] args) throws URISyntaxException { public static void main(String[] args) throws URISyntaxException {
File jarFile =
new File(Bootstrapper.class.getProtectionDomain().getCodeSource().getLocation().toURI());
File executionPath = File executionPath =
new File( new File(
new File(Bootstrapper.class.getProtectionDomain().getCodeSource().getLocation().toURI()) new File(Bootstrapper.class.getProtectionDomain().getCodeSource().getLocation().toURI())
.getParent()); .getParent());
if (!jarFile.isFile()) System.out.println("Dev environment detected!");
CLIProcessor cliProcessor = new CLIProcessor(); CLIProcessor cliProcessor = new CLIProcessor();
cliProcessor.startCLI(args, executionPath); cliProcessor.startCLI(
args, jarFile.isFile() ? executionPath : new File(System.getProperty("user.dir")));
} }
} }

View File

@ -90,7 +90,6 @@ public class CLIProcessor {
return; return;
} }
String fileName = args[1]; String fileName = args[1];
System.out.println(executionPath.getAbsolutePath());
File tasksFolder = new File(executionPath, "tasks"); File tasksFolder = new File(executionPath, "tasks");
if (!tasksFolder.exists()) if (!tasksFolder.exists())
if (!tasksFolder.mkdir()) System.err.println("Failed to create tasks folder!"); if (!tasksFolder.mkdir()) System.err.println("Failed to create tasks folder!");

View File

@ -14,7 +14,6 @@ import java.text.SimpleDateFormat;
import java.time.temporal.ChronoUnit; import java.time.temporal.ChronoUnit;
import java.util.Date; import java.util.Date;
import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.TimeUnit;
import java.util.stream.IntStream; import java.util.stream.IntStream;
@Builder @Builder