Skip to content

Commit

Permalink
Storage.java: Simplify save method
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanczx committed Sep 18, 2022
1 parent 35f1bc0 commit 9aa3ccf
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/main/java/storage/Storage.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,10 @@ public void save(ArrayList<Task> taskList, Ui ui) throws FredException {

try {
File f = new File(filePath);
File parent = new File(f.getParent());

if (!f.exists()) {
new File(f.getParent()).mkdir();
parent.mkdir();
f.createNewFile();
ui.storeMessage("No data file exists. New data file has been created.\n");
}
Expand Down

0 comments on commit 9aa3ccf

Please sign in to comment.