Create store path on storage backend creation

This commit is contained in:
Matthias Beyer 2015-12-01 17:31:41 +01:00
parent abee4d4904
commit 731d13e0ba
2 changed files with 8 additions and 2 deletions

View file

@ -25,6 +25,8 @@ mod module;
mod storage; mod storage;
mod ui; mod ui;
use std::process::exit;
fn main() { fn main() {
let yaml = load_yaml!("../etc/cli.yml"); let yaml = load_yaml!("../etc/cli.yml");
let app = App::from_yaml(yaml); let app = App::from_yaml(yaml);
@ -41,14 +43,17 @@ fn main() {
debug!("Runtime : {:?}", &rt); debug!("Runtime : {:?}", &rt);
let backend = StorageBackend::new(&rt).unwrap_or_else(|e| {
error!("Error: {}", e);
exit(1);
});
if let Some(matches) = rt.config.cli_matches.subcommand_matches("bm") { if let Some(matches) = rt.config.cli_matches.subcommand_matches("bm") {
let module = BMModule::new(&rt); let module = BMModule::new(&rt);
let commands = module.get_commands(&rt); let commands = module.get_commands(&rt);
if let Some(command) = matches.subcommand_name() { if let Some(command) = matches.subcommand_name() {
debug!("Subcommand: {}", command); debug!("Subcommand: {}", command);
let backend = StorageBackend::new(&rt);
let cmdenv = CommandEnv { let cmdenv = CommandEnv {
rt: &rt, rt: &rt,
bk: &backend, bk: &backend,

View file

@ -6,6 +6,7 @@ use std::path::Path;
use std::path::PathBuf; use std::path::PathBuf;
use std::vec::Vec; use std::vec::Vec;
use std::fs::File as FSFile; use std::fs::File as FSFile;
use std::fs::create_dir_all;
use std::fs::remove_file; use std::fs::remove_file;
use std::io::Read; use std::io::Read;
use std::io::Write; use std::io::Write;