diff --git a/src/main/java/Bootstrapper.java b/src/main/java/Bootstrapper.java index 5c166a1..41ab6b2 100644 --- a/src/main/java/Bootstrapper.java +++ b/src/main/java/Bootstrapper.java @@ -7,12 +7,18 @@ public class Bootstrapper { public static void main(String[] args) throws URISyntaxException { + File jarFile = + new File(Bootstrapper.class.getProtectionDomain().getCodeSource().getLocation().toURI()); + File executionPath = new File( new File(Bootstrapper.class.getProtectionDomain().getCodeSource().getLocation().toURI()) .getParent()); + if (!jarFile.isFile()) System.out.println("Dev environment detected!"); + CLIProcessor cliProcessor = new CLIProcessor(); - cliProcessor.startCLI(args, executionPath); + cliProcessor.startCLI( + args, jarFile.isFile() ? executionPath : new File(System.getProperty("user.dir"))); } } diff --git a/src/main/java/net/horizoncode/sysbackup/cli/CLIProcessor.java b/src/main/java/net/horizoncode/sysbackup/cli/CLIProcessor.java index 4b9cef2..9053eee 100644 --- a/src/main/java/net/horizoncode/sysbackup/cli/CLIProcessor.java +++ b/src/main/java/net/horizoncode/sysbackup/cli/CLIProcessor.java @@ -90,7 +90,6 @@ public class CLIProcessor { return; } String fileName = args[1]; - System.out.println(executionPath.getAbsolutePath()); File tasksFolder = new File(executionPath, "tasks"); if (!tasksFolder.exists()) if (!tasksFolder.mkdir()) System.err.println("Failed to create tasks folder!"); diff --git a/src/main/java/net/horizoncode/sysbackup/tasks/TaskBuilder.java b/src/main/java/net/horizoncode/sysbackup/tasks/TaskBuilder.java index 0e4af32..f204c77 100644 --- a/src/main/java/net/horizoncode/sysbackup/tasks/TaskBuilder.java +++ b/src/main/java/net/horizoncode/sysbackup/tasks/TaskBuilder.java @@ -14,7 +14,6 @@ import java.text.SimpleDateFormat; import java.time.temporal.ChronoUnit; import java.util.Date; import java.util.concurrent.LinkedBlockingQueue; -import java.util.concurrent.TimeUnit; import java.util.stream.IntStream; @Builder