From 2e61f4c4899a24e3d0fe5b3d0097bc8cab2502b3 Mon Sep 17 00:00:00 2001 From: WindiStone Date: Wed, 18 Sep 2024 20:44:57 +0800 Subject: [PATCH] History: Edit the save file directory --- src/main/java/WindeTasks.txt | 1 - src/main/java/windebot/History.java | 12 +++++++++--- src/main/java/windebot/WindeTasks.txt | 1 + 3 files changed, 10 insertions(+), 4 deletions(-) create mode 100644 src/main/java/windebot/WindeTasks.txt diff --git a/src/main/java/WindeTasks.txt b/src/main/java/WindeTasks.txt index e8a090a47c..e69de29bb2 100644 --- a/src/main/java/WindeTasks.txt +++ b/src/main/java/WindeTasks.txt @@ -1 +0,0 @@ -T | O | something diff --git a/src/main/java/windebot/History.java b/src/main/java/windebot/History.java index 44b8659210..7a4aba7055 100644 --- a/src/main/java/windebot/History.java +++ b/src/main/java/windebot/History.java @@ -20,7 +20,10 @@ */ public class History { - private static final String WINDE_FILE = "./src/main/java/WindeTasks.txt"; + private static final String WINDE_FILE = "./src/main/java/windebot/WindeTasks.txt"; + private static final String WINDE_ALTERNATE_FILE = "/Users/winston/Desktop/Code/CS2103/ip/src/main/java/windebot/Winde.java"; + private static final String WINDE_ANOTHER_FILE = "../src/main/java/windebot/Winde.java"; + private static String filePath; /** @@ -38,7 +41,7 @@ public class History { */ History() { - this.filePath = WINDE_FILE; + this.filePath = WINDE_ANOTHER_FILE; } /** @@ -53,6 +56,9 @@ public static ArrayList load() { try { if (!file.exists()) { file.createNewFile(); + file.getParentFile().mkdirs(); + file.createNewFile(); + // file.exists(); } } catch (IOException ioe) { System.out.println("Error in creating file" + ioe.getMessage()); @@ -77,7 +83,7 @@ public static ArrayList load() { * @return A task which the file line was coding for. */ - public static Task readLine(String line) { + private static Task readLine(String line) { String complete = "X"; DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd/MM/yyyy HH:mm"); Task task; diff --git a/src/main/java/windebot/WindeTasks.txt b/src/main/java/windebot/WindeTasks.txt new file mode 100644 index 0000000000..67907f1896 --- /dev/null +++ b/src/main/java/windebot/WindeTasks.txt @@ -0,0 +1 @@ +T | O | nothing