feat(updater): use try_exists instead of exists (#218)

This commit is contained in:
Felix Angelov
2023-04-03 11:08:47 -05:00
committed by GitHub
parent f1ff11dfaf
commit b939ef074d
+12 -2
View File
@@ -172,8 +172,18 @@ fn get_base_path(original_lib_app_paths: &Vec<String>) -> anyhow::Result<PathBuf
// Iterate through the paths and find the first one that exists.
for path in original_lib_app_paths {
let path = PathBuf::from(path);
if path.exists() {
return Ok(path);
match path.try_exists() {
Ok(true) => {
return Ok(path);
}
Ok(false) => {
info!("File does not exist: {:?}", path);
continue;
}
Err(err) => {
info!("Failed to check for file: {:?}, err: {err}", path);
continue;
}
}
}
return Err(UpdateError::InvalidState("No base file found".to_string()).into());