Compare commits

...

3 Commits

Author SHA1 Message Date
1000d52556 Code formatting 2025-10-11 18:10:28 -04:00
17e46f04f7 Made some changes to the method 2025-10-11 18:10:11 -04:00
d5e0f7c64e Added method to remove file from the filesystem 2025-10-11 18:09:50 -04:00
2 changed files with 17 additions and 2 deletions

View File

@@ -39,7 +39,20 @@ impl CoverArt {
}
}
// TODO: Add method to remove from filesystem
/// Removes the coverart from the filesystem
pub fn remove_from_filesystem(&self) -> Result<(), std::io::Error> {
let p = std::path::Path::new(&self.path);
if p.exists() {
match std::fs::remove_file(p) {
Ok(_) => Ok(()),
Err(err) => Err(err),
}
} else {
Err(std::io::Error::other(
"Cannot delete file that does not exist",
))
}
}
}
pub mod io {

View File

@@ -118,7 +118,9 @@ impl Song {
Err(err) => Err(err),
}
} else {
Ok(())
Err(std::io::Error::other(
"Cannot delete file that does not exist",
))
}
}
Err(err) => Err(err),