Skip to content
Snippets Groups Projects
Commit 5ce58f06 authored by Harry Linrui XU's avatar Harry Linrui XU
Browse files

Added method for clearing SelectedBudget.current file

parent efb49169
No related branches found
No related tags found
1 merge request!43Merging frontend-testing into master
......@@ -22,7 +22,7 @@ public class FileHandlingSelectedBudget {
selectedBudgetFileType))) {
return br.readLine();
} catch (IOException ioException) {
throw new IOException("File: CurrentFile.txt does not exist", ioException);
throw new IOException("File: SelectedBudget.current does not exist", ioException);
}
}
......@@ -36,6 +36,16 @@ public class FileHandlingSelectedBudget {
}
}
public static void clearSelectedBudget() throws IOException {
try (BufferedWriter bw = new BufferedWriter(new FileWriter(filePath + "SelectedBudget" +
selectedBudgetFileType))) {
bw.write("");
System.out.println("Current file is: ");
} catch (IOException ex) {
throw new IOException("Error writing to file: " + "SelectedBudget.current");
}
}
public static boolean isSelectedBudgetEmpty(String fileTitle) throws IOException {
try (BufferedReader br = new BufferedReader(new FileReader(filePath
+ "SelectedBudget" + selectedBudgetFileType))) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment