diff --git a/docs/dukey.txt b/docs/dukey.txt index 38507717..cbfc841a 100644 --- a/docs/dukey.txt +++ b/docs/dukey.txt @@ -1 +1,3 @@ 1.[T][ ] kill akshay +2.[T][ ] kill minjun +3.[D][ ] kill (by: 9) diff --git a/src/main/java/Dukey.java b/src/main/java/Dukey.java index a2881c3b..9dd8a585 100644 --- a/src/main/java/Dukey.java +++ b/src/main/java/Dukey.java @@ -165,15 +165,10 @@ public static void main(String[] args) throws IOException { String file2 = "./docs/dukey.txt"; File file = new File(file2); // Check if the file or directory exists, and create it if it doesn't - if (!file.exists()) { - try { - if (file.getParentFile() != null && !file.getParentFile().exists()) { - file.getParentFile().mkdirs(); - } - file.createNewFile(); // Create the file - } catch (IOException e) { - System.out.println("Something went wrong: " + e.getMessage()); - } + if (file.createNewFile()) { + System.out.println("File created"); + } else { + System.out.println("File already exists"); } try { fileToTaskArray(file2, tasks);