Skip to content

Commit

Permalink
minor bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Hzxin committed Feb 15, 2021
1 parent 227568d commit 0b4c2df
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/main/java/duke/utils/Statistics.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
* Statistics class that keep track of the number of done tasks;
*/
public class Statistics {
private static final String DIRECTORY = "data";
private static final String FILEPATH = "data/Statistics.txt";

private static int totalTaskHistory = 0;
Expand Down Expand Up @@ -84,6 +85,10 @@ private static String reformatTask(Task task) {
* Initializes the statistic file.
*/
public static void initialize() {
File directory = new File(DIRECTORY);
if (!directory.exists()) {
directory.mkdir();
}
File statisticsFile = new File(FILEPATH);
if (!statisticsFile.exists()) {
try {
Expand Down

0 comments on commit 0b4c2df

Please sign in to comment.