Browse Source

check inited in storage

fix-typo
Coin de Gamma 3 months ago
parent
commit
c679d4bf74
  1. 10
      src/storage.rs

10
src/storage.rs

@ -110,7 +110,12 @@ impl Storage {
}
}
pub fn from_db(passphrase: String) -> io::Result<Storage> {
// TODO: throw error if it's not inited
if !Storage::is_inited() {
return Err(io::Error::new(
io::ErrorKind::Other,
"Storage is not initialized"
));
}
let encoder = Encoder::from(passphrase);
// TODO: throw error is password is incorrect
let file = fs::File::open(&*STORAGE_PATH)?;
@ -173,8 +178,11 @@ impl Storage {
}
pub fn is_inited() -> bool {
// TODO: check db
// TODO check git
let path = Path::new(&*STORAGE_FOLDER);
return path.exists();
}
pub fn ids(&self) -> Vec<String> {

Loading…
Cancel
Save