Skip to content

Commit

Permalink
fix: added additional paths to allowlist to prevent sarm from not fin…
Browse files Browse the repository at this point in the history
…ding install paths
  • Loading branch information
Tormak9970 committed May 11, 2024
1 parent 1dff444 commit 27d87bc
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 21 deletions.
33 changes: 13 additions & 20 deletions src-tauri/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -537,32 +537,25 @@ async fn clean_grids(app_handle: AppHandle, steam_path: String, steam_active_use
#[tauri::command]
// Validates the steam install path
async fn validate_steam_path(app_handle: AppHandle, target_path: String) -> bool {
let pre_canonicalized_path: PathBuf = PathBuf::from(&target_path);
let steam_path_res = pre_canonicalized_path.canonicalize();
let steam_path: PathBuf = PathBuf::from(&target_path);

if steam_path_res.is_ok() {
let steam_path = steam_path_res.ok().unwrap();
let steam_path_str: String = steam_path.to_str().expect("Should have been able to convert pathbuf to string").to_owned();
let steam_path_str: String = steam_path.to_str().expect("Should have been able to convert pathbuf to string").to_owned();

add_path_to_scope(app_handle, steam_path_str).await;
add_path_to_scope(app_handle, steam_path_str).await;

if steam_path.exists() {
let contents_res = fs::read_dir(steam_path);
let mut contents = contents_res.ok().expect("Should have been able to read the provided directory.");
if steam_path.exists() {
let contents_res = fs::read_dir(steam_path);
let mut contents = contents_res.ok().expect("Should have been able to read the provided directory.");

return contents.any(| entry_res | {
if entry_res.is_ok() {
let entry = entry_res.ok().expect("Entry should have been ok");
return contents.any(| entry_res | {
if entry_res.is_ok() {
let entry = entry_res.ok().expect("Entry should have been ok");

return entry.file_name().eq_ignore_ascii_case("steam.exe") || entry.file_name().eq_ignore_ascii_case("steam.sh");
}
return entry.file_name().eq_ignore_ascii_case("steam.exe") || entry.file_name().eq_ignore_ascii_case("steam.sh");
}

return false;
});
}
} else {
let path_err = steam_path_res.err().unwrap();
logger::log_to_core_file(app_handle.to_owned(), format!("Error canonicalizing {}: {}.", target_path, path_err.to_string()).as_str(), 1);
return false;
});
}

return false;
Expand Down
4 changes: 4 additions & 0 deletions src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
"/var/home/*/.config/dev.tormak.steam-art-manager/**",
"$Home/**",
"/var/home/*/**",
"/home/*/.steam/**",
"/home/*/.local/share/steam/**",
"$DATA",
"$DATA/**",
"$APPLOG",
Expand Down Expand Up @@ -63,6 +65,8 @@
"/var/home/*/.config/dev.tormak.steam-art-manager/**",
"$Home/**",
"/var/home/*/**",
"/home/*/.steam/**",
"/home/*/.local/share/steam/**",
"$DATA",
"$DATA/**",
"$APPLOG",
Expand Down
2 changes: 1 addition & 1 deletion src/components/modals/settings/SettingsModal.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@
<div class="settings-container">
<FilePathEntry
label="Steam Install Path"
description={"The root of your Steam installation. The default on Windows is <b>C:/Program Files (x86)/Steam</b> and <b>~/.steam/steam</b> on Linux. You must restart after changing this."}
description={"The root of your Steam installation. The default on Windows is <b>C:/Program Files (x86)/Steam</b> and <b>/home/deck/.steam/steam</b> on Linux. You must restart after changing this."}
value={steamInstallLocation}
onChange={onInstallLocationChange}
useValidator
Expand Down

0 comments on commit 27d87bc

Please sign in to comment.