diff options
Diffstat (limited to 'src/manager.rs')
-rw-r--r-- | src/manager.rs | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/manager.rs b/src/manager.rs index 839c8dc..74f449b 100644 --- a/src/manager.rs +++ b/src/manager.rs | |||
@@ -49,15 +49,18 @@ impl Manager { | |||
49 | self.feeds.iter() | 49 | self.feeds.iter() |
50 | } | 50 | } |
51 | 51 | ||
52 | pub async fn store(&self) -> Result<StoreStatus, IOError> { | 52 | pub fn store(&self) -> Result<StoreStatus, IOError> { |
53 | let path = crate::dirs::store_path().ok_or(IOError::MissingStorePath)?; | 53 | let path = crate::dirs::store_path().ok_or(IOError::MissingStorePath)?; |
54 | let content = serde_yaml::to_string(&self.feeds)?; | 54 | let content = serde_yaml::to_string(&self.feeds)?; |
55 | std::fs::write(path, content)?; | ||
56 | 55 | ||
57 | Ok(StoreStatus::new(self.feeds.len())) | 56 | std::fs::write(&path, content)?; |
57 | |||
58 | let count = self.feeds.len(); | ||
59 | let location = path; | ||
60 | Ok(StoreStatus::new(count, location)) | ||
58 | } | 61 | } |
59 | 62 | ||
60 | pub async fn load() -> Result<Self, IOError> { | 63 | pub fn load() -> Result<Self, IOError> { |
61 | let path = crate::dirs::store_path().ok_or(IOError::MissingStorePath)?; | 64 | let path = crate::dirs::store_path().ok_or(IOError::MissingStorePath)?; |
62 | let content = std::fs::read_to_string(path)?; | 65 | let content = std::fs::read_to_string(path)?; |
63 | let feeds = serde_yaml::from_str(&content)?; | 66 | let feeds = serde_yaml::from_str(&content)?; |