diff --git a/src/config_util.rs b/src/config_util.rs index 1ee437c..b95dd52 100644 --- a/src/config_util.rs +++ b/src/config_util.rs @@ -27,12 +27,14 @@ pub const DOT_OSS_BACKUPD_CONFIG: &str = ".oss-backupd-config.json"; }, "host": "", "encrypt_pubkey_file": "", + "backup_count": 10, "items": [ { "oss_config": null, // OPT @oss_config "target": "", "file_name": "", - "encrypt_pubkey_file": null // OPT @encrypt_pubkey_file + "encrypt_pubkey_file": null, // OPT @encrypt_pubkey_file + "backup_count": 8 } ] } diff --git a/src/zip_util.rs b/src/zip_util.rs index e84dede..4efe3f9 100644 --- a/src/zip_util.rs +++ b/src/zip_util.rs @@ -72,10 +72,7 @@ pub fn zip_file(target: &str, zip_file: &str) -> XResult<()> { pub fn get_file_name(path: &Path) -> String { match path.file_name() { - None => "no_file_name".to_string(), - Some(f) => match f.to_os_string().into_string().ok() { - None => "unknown_file_name".to_string(), - Some(f) => f, - }, + None => "no_file_name".to_owned(), + Some(f) => f.to_os_string().into_string().unwrap_or("unknown_file_name".to_owned()), } } \ No newline at end of file