Store::remove(): Move function so we have a better order
This commit is contained in:
parent
c681b24ef4
commit
911c248c39
1 changed files with 23 additions and 23 deletions
|
@ -294,29 +294,6 @@ impl Store {
|
||||||
self.load(m, parser, &id)
|
self.load(m, parser, &id)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Remove a file from the filesystem by FileID
|
|
||||||
*
|
|
||||||
* Returns true if this works.
|
|
||||||
*/
|
|
||||||
pub fn remove(&self, id: FileID) -> bool {
|
|
||||||
use std::fs::remove_file;
|
|
||||||
|
|
||||||
self.cache
|
|
||||||
.borrow_mut()
|
|
||||||
.remove(&id)
|
|
||||||
.map(|file| {
|
|
||||||
let idstr : String = id.into();
|
|
||||||
let path = format!("{}/{}-{}.imag",
|
|
||||||
self.storepath,
|
|
||||||
file.deref().borrow().owner_name(),
|
|
||||||
idstr);
|
|
||||||
debug!("Removing file NOW: '{}'", path);
|
|
||||||
remove_file(path).is_ok()
|
|
||||||
})
|
|
||||||
.unwrap_or(false)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load all files for a module
|
* Load all files for a module
|
||||||
*/
|
*/
|
||||||
|
@ -346,6 +323,29 @@ impl Store {
|
||||||
res
|
res
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove a file from the filesystem by FileID
|
||||||
|
*
|
||||||
|
* Returns true if this works.
|
||||||
|
*/
|
||||||
|
pub fn remove(&self, id: FileID) -> bool {
|
||||||
|
use std::fs::remove_file;
|
||||||
|
|
||||||
|
self.cache
|
||||||
|
.borrow_mut()
|
||||||
|
.remove(&id)
|
||||||
|
.map(|file| {
|
||||||
|
let idstr : String = id.into();
|
||||||
|
let path = format!("{}/{}-{}.imag",
|
||||||
|
self.storepath,
|
||||||
|
file.deref().borrow().owner_name(),
|
||||||
|
idstr);
|
||||||
|
debug!("Removing file NOW: '{}'", path);
|
||||||
|
remove_file(path).is_ok()
|
||||||
|
})
|
||||||
|
.unwrap_or(false)
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper to generate a new FileID object
|
* Helper to generate a new FileID object
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in a new issue