From 68deb446eb9aac4812d1dfe6d9008fdd46080931 Mon Sep 17 00:00:00 2001 From: RanXom Date: Sat, 13 Jun 2026 00:57:35 +0530 Subject: clear status on quit --- src/pomo/mod.rs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/pomo/mod.rs') 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> { + 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> { 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(); } } -- cgit v1.2.3