ref code
This commit is contained in:
@@ -236,12 +236,12 @@ fn get_config_content(custom_oss_backupd_config: Option<&str>, verbose: bool) ->
|
|||||||
}
|
}
|
||||||
let custom_oss_backupd_config_path = Path::new(custom_oss_backupd_config_unrwaped);
|
let custom_oss_backupd_config_path = Path::new(custom_oss_backupd_config_unrwaped);
|
||||||
if custom_oss_backupd_config_path.exists() {
|
if custom_oss_backupd_config_path.exists() {
|
||||||
match fs::read_to_string(custom_oss_backupd_config_path) {
|
return match fs::read_to_string(custom_oss_backupd_config_path) {
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
print_message(MessageType::ERROR, &format!("Read config file {} error: {}", custom_oss_backupd_config_unrwaped, e));
|
print_message(MessageType::ERROR, &format!("Read config file {} error: {}", custom_oss_backupd_config_unrwaped, e));
|
||||||
return None;
|
None
|
||||||
},
|
},
|
||||||
Ok(o) => return Some(o),
|
Ok(o) => Some(o),
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
print_message(MessageType::ERROR, &format!("Custom config file not found: {}", custom_oss_backupd_config_unrwaped));
|
print_message(MessageType::ERROR, &format!("Custom config file not found: {}", custom_oss_backupd_config_unrwaped));
|
||||||
@@ -254,12 +254,12 @@ fn get_config_content(custom_oss_backupd_config: Option<&str>, verbose: bool) ->
|
|||||||
if verbose {
|
if verbose {
|
||||||
print_message(MessageType::DEBUG, &format!("Read config from: {}", OSS_BACKUPD_CONFIG));
|
print_message(MessageType::DEBUG, &format!("Read config from: {}", OSS_BACKUPD_CONFIG));
|
||||||
}
|
}
|
||||||
match fs::read_to_string(oss_backupd_config_path) {
|
return match fs::read_to_string(oss_backupd_config_path) {
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
print_message(MessageType::ERROR, &format!("Read config file {} error: {}", OSS_BACKUPD_CONFIG, e));
|
print_message(MessageType::ERROR, &format!("Read config file {} error: {}", OSS_BACKUPD_CONFIG, e));
|
||||||
return None;
|
None
|
||||||
},
|
},
|
||||||
Ok(o) => return Some(o),
|
Ok(o) => Some(o),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
let home_dot_oss_backupd_config = & match get_user_home_dir(DOT_OSS_BACKUPD_CONFIG) {
|
let home_dot_oss_backupd_config = & match get_user_home_dir(DOT_OSS_BACKUPD_CONFIG) {
|
||||||
@@ -275,12 +275,12 @@ fn get_config_content(custom_oss_backupd_config: Option<&str>, verbose: bool) ->
|
|||||||
if verbose {
|
if verbose {
|
||||||
print_message(MessageType::DEBUG, &format!("Read config from: {}", home_dot_oss_backupd_config));
|
print_message(MessageType::DEBUG, &format!("Read config from: {}", home_dot_oss_backupd_config));
|
||||||
}
|
}
|
||||||
match fs::read_to_string(home_dot_oss_backupd_config_path) {
|
return match fs::read_to_string(home_dot_oss_backupd_config_path) {
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
print_message(MessageType::ERROR, &format!("Read config file {} error: {}", home_dot_oss_backupd_config, e));
|
print_message(MessageType::ERROR, &format!("Read config file {} error: {}", home_dot_oss_backupd_config, e));
|
||||||
return None;
|
None
|
||||||
},
|
},
|
||||||
Ok(o) => return Some(o),
|
Ok(o) => Some(o),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -289,12 +289,12 @@ fn get_config_content(custom_oss_backupd_config: Option<&str>, verbose: bool) ->
|
|||||||
if verbose {
|
if verbose {
|
||||||
print_message(MessageType::DEBUG, &format!("Read config from: {}", ETC_OSS_BACKUPD_CONFIG));
|
print_message(MessageType::DEBUG, &format!("Read config from: {}", ETC_OSS_BACKUPD_CONFIG));
|
||||||
}
|
}
|
||||||
match fs::read_to_string(etc_oss_backupd_config_path) {
|
return match fs::read_to_string(etc_oss_backupd_config_path) {
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
print_message(MessageType::ERROR, &format!("Read config file {} error: {}", ETC_OSS_BACKUPD_CONFIG, e));
|
print_message(MessageType::ERROR, &format!("Read config file {} error: {}", ETC_OSS_BACKUPD_CONFIG, e));
|
||||||
return None;
|
None
|
||||||
},
|
},
|
||||||
Ok(o) => return Some(o),
|
Ok(o) => Some(o),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user