aboutsummaryrefslogtreecommitdiff
path: root/src-tauri
diff options
context:
space:
mode:
authorJan <sentrycraft123@gmail.com>2023-02-02 13:06:34 +0100
committerGitHub <noreply@github.com>2023-02-02 13:06:34 +0100
commit0f09fc76d4390811be71bc0e9a0e44a50ecb6440 (patch)
treed1cbf1d3e2e767b9e351ad8e6af5af4d37577d6e /src-tauri
parentfe0ada0c733687050a6a16d19d45a3de7790de7d (diff)
downloadFlightCore-0f09fc76d4390811be71bc0e9a0e44a50ecb6440.tar.gz
FlightCore-0f09fc76d4390811be71bc0e9a0e44a50ecb6440.zip
refactor: Deal with `fs::read_dir` failure instead of checking if exists (#155)
* refactor: Deal with fs::read_dir failure instead of checking if exists
Diffstat (limited to 'src-tauri')
-rw-r--r--src-tauri/src/repair_and_verify/mod.rs10
1 files changed, 4 insertions, 6 deletions
diff --git a/src-tauri/src/repair_and_verify/mod.rs b/src-tauri/src/repair_and_verify/mod.rs
index fb108f37..5d58dfaf 100644
--- a/src-tauri/src/repair_and_verify/mod.rs
+++ b/src-tauri/src/repair_and_verify/mod.rs
@@ -71,13 +71,11 @@ pub fn clean_up_download_folder(
pub fn get_log_list(game_install: GameInstall) -> Result<Vec<std::path::PathBuf>, String> {
let ns_log_folder = format!("{}/R2Northstar/logs", game_install.game_path);
- // Check if logs folder exists
- if !std::path::Path::new(&ns_log_folder).exists() {
- return Err("No logs folder found".to_string());
- }
-
// List files in logs folder
- let paths = std::fs::read_dir(ns_log_folder).unwrap();
+ let paths = match std::fs::read_dir(ns_log_folder) {
+ Ok(paths) => paths,
+ Err(_err) => return Err("No logs folder found".to_string()),
+ };
// Stores paths of log files
let mut log_files: Vec<std::path::PathBuf> = Vec::new();