mirror of
https://github.com/lifegpc/game-auto-sync.git
synced 2026-06-06 05:48:58 +08:00
Bug fix
This commit is contained in:
16
src/cfg.rs
16
src/cfg.rs
@@ -71,19 +71,13 @@ impl Config {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn game_backuper_cfg(&self) -> String {
|
||||
match self.get_str("game_backuper_cfg") {
|
||||
Some(s) => {
|
||||
pub fn game_backuper_cfg(&self) -> Option<String> {
|
||||
let mut pb = crate::utils::get_exe_path_else_current();
|
||||
pb.push(s);
|
||||
pb.to_string_lossy().to_string()
|
||||
},
|
||||
None => {
|
||||
let mut pb = crate::utils::get_exe_path_else_current();
|
||||
pb.push("game_backuper.yml");
|
||||
pb.to_string_lossy().to_string()
|
||||
},
|
||||
pb.push(self.get_str("game_backuper_cfg").unwrap_or("game_backuper.yml"));
|
||||
if !pb.exists() {
|
||||
return None;
|
||||
}
|
||||
Some(pb.to_string_lossy().to_string())
|
||||
}
|
||||
|
||||
pub fn game_backuper_exe(&self) -> String {
|
||||
|
||||
@@ -38,8 +38,7 @@ impl Main {
|
||||
Some(cml) => cml,
|
||||
None => {
|
||||
let mut def = vec![self._cfg.game_backuper_exe()];
|
||||
let cfg_path = self._cfg.game_backuper_cfg();
|
||||
if std::fs::exists(&cfg_path).unwrap_or(false) {
|
||||
if let Some(cfg_path) = self._cfg.game_backuper_cfg() {
|
||||
def.push(String::from("-c"));
|
||||
def.push(cfg_path);
|
||||
}
|
||||
@@ -74,8 +73,7 @@ impl Main {
|
||||
Some(cml) => cml,
|
||||
None => {
|
||||
let mut def = vec![self._cfg.game_backuper_exe()];
|
||||
let cfg_path = self._cfg.game_backuper_cfg();
|
||||
if std::fs::exists(&cfg_path).unwrap_or(false) {
|
||||
if let Some(cfg_path) = self._cfg.game_backuper_cfg() {
|
||||
def.push(String::from("-c"));
|
||||
def.push(cfg_path);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user