use titanite library for backend

This commit is contained in:
yggverse 2025-02-21 22:18:07 +02:00
parent a4518ba93d
commit 08c437920c
6 changed files with 89 additions and 147 deletions

View file

@ -63,10 +63,13 @@ impl Item {
// Actions
/// Take object processed, commit its changes
pub fn commit(self) -> Result<()> {
pub fn commit(self) -> Result<String> {
match self.path.to_str() {
Some(old) => match old.strip_suffix(TMP_SUFFIX) {
Some(new) => Ok(rename(old, new)?),
Some(new) => {
rename(old, new)?;
Ok(new.to_string())
}
None => bail!("Invalid TMP suffix"), // | panic
},
None => bail!("Invalid Item path"), // | panic