diff options
| author | RanXom <saiyedshizain@gmail.com> | 2026-06-13 00:57:35 +0530 |
|---|---|---|
| committer | RanXom <saiyedshizain@gmail.com> | 2026-06-13 00:57:35 +0530 |
| commit | 68deb446eb9aac4812d1dfe6d9008fdd46080931 (patch) | |
| tree | bec68b189a1bae3537a0b8630932ef91787fa339 /src | |
| parent | 447ad9dc6afc9d3efb733f4f0a8688acae54f6a6 (diff) | |
| download | pomoru-68deb446eb9aac4812d1dfe6d9008fdd46080931.tar.xz pomoru-68deb446eb9aac4812d1dfe6d9008fdd46080931.zip | |
clear status on quit
Diffstat (limited to 'src')
| -rw-r--r-- | src/pomo/mod.rs | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/pomo/mod.rs b/src/pomo/mod.rs index bff80a9..d1043e8 100644 --- a/src/pomo/mod.rs +++ b/src/pomo/mod.rs @@ -57,6 +57,21 @@ impl Pomo { Ok(()) } + pub fn clear_status(&self) -> Result<(), Box<dyn std::error::Error>> { + let cache_dir = ProjectDirs::from("", "", "pomoru") + .ok_or("Could not find cache directory")? + .cache_dir() + .to_path_buf(); + + let status_file = cache_dir.join("status.json"); + + if status_file.exists() { + fs::remove_file(status_file)?; + } + + Ok(()) + } + pub fn save(&self) -> Result<(), Box<dyn std::error::Error>> { let config = Config { work_time_mins: self.work_time.as_secs() / 60, @@ -129,6 +144,7 @@ impl Pomo { if self.should_quit { let _ = self.save(); + let _ = self.clear_status(); } } |