Skip to content

Commit

Permalink
Fix bug on taskListTest file creation
Browse files Browse the repository at this point in the history
  • Loading branch information
freddychenyouren2 committed Sep 22, 2023
1 parent e403757 commit 95125bd
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/main/java/duke/util/Storage.java
Original file line number Diff line number Diff line change
Expand Up @@ -102,13 +102,22 @@ public void checkDirectory() {
public void checkFile() {
try {
Path file = Path.of("./data/duke.txt");
Path fileForTesting = Path.of("./data/taskListTest.txt");
if (!Files.exists(file)) {
System.out.println("System Message: File 'duke.txt' does not exist. Creating one..."
+ "You can view it under 'data' directory after exiting the program this time.");
Files.createFile(file);
} else {
System.out.println("System Message: File 'duke.txt' exists! Loading past data...");
}

if (!Files.exists(fileForTesting)) {
System.out.println("System Message: File 'taskListTest.txt' does not exist. Creating one..."
+ "You can view it under 'data' directory after exiting the program this time.");
Files.createFile(fileForTesting);
} else {
System.out.println("System Message: File 'taskListTest.txt' exists!");
}
} catch (IOException e) {
System.out.printf("Error while creating directory: %s", e.getMessage());
}
Expand Down

0 comments on commit 95125bd

Please sign in to comment.