aboutsummaryrefslogtreecommitdiff
path: root/src-tauri/src/repair_and_verify
diff options
context:
space:
mode:
authorGeckoEidechse <40122905+GeckoEidechse@users.noreply.github.com>2022-11-25 10:09:04 +0100
committerGitHub <noreply@github.com>2022-11-25 10:09:04 +0100
commit345b617c765c29c44627f5657ed2056c731481c9 (patch)
treee6436b097da03800d278e564f0974a1f36724228 /src-tauri/src/repair_and_verify
parentf65a330bba626435510bc9f6afccd6d895416bc3 (diff)
downloadFlightCore-345b617c765c29c44627f5657ed2056c731481c9.tar.gz
FlightCore-345b617c765c29c44627f5657ed2056c731481c9.zip
refactor: Move function to dedicated module (#67)
Getting log files is part of repair and troubleshooting
Diffstat (limited to 'src-tauri/src/repair_and_verify')
-rw-r--r--src-tauri/src/repair_and_verify/mod.rs28
1 files changed, 28 insertions, 0 deletions
diff --git a/src-tauri/src/repair_and_verify/mod.rs b/src-tauri/src/repair_and_verify/mod.rs
index 188d3821..32715622 100644
--- a/src-tauri/src/repair_and_verify/mod.rs
+++ b/src-tauri/src/repair_and_verify/mod.rs
@@ -65,3 +65,31 @@ pub fn clean_up_download_folder(
Ok(())
}
+
+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();
+
+ // Stores paths of log files
+ let mut log_files: Vec<std::path::PathBuf> = Vec::new();
+
+ for path in paths {
+ let path = path.unwrap().path();
+ if path.display().to_string().contains("nslog") {
+ log_files.push(path);
+ }
+ }
+
+ if log_files.len() > 0 {
+ Ok(log_files)
+ } else {
+ Err("No logs found".to_string())
+ }
+}