Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 2 commits into from
Apr 3, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions updater/library/src/updater.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down