Skip to content

Commit

Permalink
Recover Duke class
Browse files Browse the repository at this point in the history
  • Loading branch information
J-Y-Yan committed Nov 14, 2023
1 parent 80a6ac8 commit 8a8e8c2
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/main/java/seedu/duke/Duke.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,13 @@
import seedu.duke.commands.ExitCommand;
import seedu.duke.parser.Parser;
import seedu.duke.exerciselog.Log;
import seedu.duke.storagefile.AchmStorage;
import seedu.duke.storagefile.GoalStorage;
import seedu.duke.ui.TextUi;
import seedu.duke.storagefile.ExerciseLogStorage;

import java.util.ArrayList;

/**
* Entry point of the Address Book application.
* Initializes the application and starts the interaction with the user.
Expand All @@ -19,14 +23,18 @@ public class Duke {
*/
public static final String VERSION = "Version-2.1";
public static Log exerciseLog = new Log();
public static GoalList goalList = new GoalList();
public static GoalList achievedGoals = new GoalList();
public static ExerciseLogStorage exerciseLogStorage;
public static TextUi ui;
public static GoalStorage goalStorage;
public static AchmStorage achmStorage;
private final String dirPath = "data";
private final String exerciseLogFilePath = "./data/ExerciseLog.txt";
private final String goalFilePath = "./data/GoalRecord.txt";
private final String achmFilePath = "./data/Achievement.txt";
private final String mealSavePath = "Meal.json";

public static void main(String... launchArgs) {
new Duke().run(launchArgs);
}
Expand All @@ -52,6 +60,10 @@ private void start(String[] launchArgs) {
ui = new TextUi();
exerciseLogStorage = ExerciseLogStorage.initializeStorage(dirPath, exerciseLogFilePath);
exerciseLogStorage.checkForLogTextFile(exerciseLog);
goalStorage = GoalStorage.initializeGoalStorage(dirPath, goalFilePath);
goalStorage.restoreGoalRecord();
achmStorage = AchmStorage.initializeGoalStorage(dirPath, achmFilePath);
achmStorage.restoreGoalRecord();
ui.showWelcomeMessage(VERSION, "storage.getPath()");
} catch (Exception e) { // TODO: change to specific storage exceptions later
ui.showInitFailedMessage();
Expand Down

0 comments on commit 8a8e8c2

Please sign in to comment.