Change snapshot directory to data/snapshots

next
Sayan Nandan 3 years ago
parent f60b3098da
commit f013a90179

@ -26,6 +26,7 @@
//! This module provides tools to handle configuration files and settings
use crate::diskstore::snapshot::DIR_SNAPSHOT;
#[cfg(test)]
use libsky::TResult;
use serde::Deserialize;
@ -410,7 +411,7 @@ pub fn get_config_file_or_return_cfg() -> Result<ConfigType<ParsedConfig, PathBu
let cfg_layout = load_yaml!("../cli.yml");
let matches = App::from_yaml(cfg_layout).get_matches();
let restorefile = matches.value_of("restore").map(|val| {
let mut path = PathBuf::from("snapshots/");
let mut path = PathBuf::from(DIR_SNAPSHOT);
path.push(val);
path
});

@ -324,17 +324,7 @@ pub async fn run(
Err(e) => match e.kind() {
ErrorKind::AlreadyExists => (),
_ => {
log::error!("Failed to create snapshot directories: '{}'", e);
process::exit(0x100);
}
},
}
match fs::create_dir("./data") {
Ok(_) => (),
Err(e) => match e.kind() {
ErrorKind::AlreadyExists => (),
_ => {
log::error!("Failed to create snapshot directories: '{}'", e);
log::error!("Failed to create data directories: '{}'", e);
process::exit(0x100);
}
},

@ -46,13 +46,13 @@ lazy_static::lazy_static! {
/// ```
static ref SNAP_MATCH: Regex = Regex::new("^\\d{4}(0[1-9]|1[012])(0[1-9]|[12][0-9]|3[01])(-)(?:(?:([01]?\\d|2[0-3]))?([0-5]?\\d))?([0-5]?\\d)(.snapshot)$").unwrap();
/// The directory for remote snapshots
pub static ref DIR_REMOTE_SNAPSHOT: PathBuf = PathBuf::from("./snapshots/remote");
pub static ref DIR_REMOTE_SNAPSHOT: PathBuf = PathBuf::from("./data/snapshots/remote");
}
/// The default snapshot directory
///
/// This is currently a `snapshot` directory under the current directory
pub const DIR_SNAPSHOT: &'static str = "snapshots";
pub const DIR_SNAPSHOT: &'static str = "data/snapshots";
/// The default snapshot count is 12, assuming that the user would take a snapshot
/// every 2 hours (or 7200 seconds)
const DEF_SNAPSHOT_COUNT: usize = 12;

Loading…
Cancel
Save