-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8d19875
commit 790badd
Showing
5 changed files
with
60 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,3 +5,4 @@ edition = "2021" | |
|
||
[dependencies] | ||
reqwest = { version = "0.11.18", features = ["blocking"] } | ||
serde_json = "1.0.103" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"proton_installations": { | ||
"Proton - Experimental": "/home/wav/.steam/steam/steamapps/common/Proton - Experimental", | ||
"Proton 6.3": "/home/wav/.steam/steam/steamapps/common/Proton 6.3" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
pub mod installation; | ||
pub mod setup; | ||
pub mod terminal; | ||
pub mod proton; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
use std::fs; | ||
use crate::utils::terminal::*; | ||
use serde_json; | ||
|
||
pub fn discover_proton_directory() -> serde_json::Value { // Try to automatically find where Proton is installed to | ||
let potental_path = format!("{}/.steam/steam/steamapps/common/", env!("HOME")); | ||
let mut installations = serde_json::json!({ | ||
"proton_installations": { } | ||
}); | ||
|
||
match fs::read_dir(potental_path.clone()) { | ||
Ok(_) => { | ||
status(format!("Found Steam directory at '{}'", potental_path)); | ||
|
||
for entry in fs::read_dir(potental_path.clone()).unwrap() { | ||
let unwrapped_entry = entry.unwrap(); | ||
let path = unwrapped_entry.path(); | ||
let fsname = path.file_name().unwrap().to_str().unwrap(); | ||
|
||
if fsname.contains("Proton") { | ||
success(format!("Found '{}' at '{}'", fsname, path.to_str().unwrap())); | ||
installations["proton_installations"][fsname] = serde_json::Value::String(path.to_str().unwrap().to_string()); | ||
} | ||
} | ||
|
||
return installations; | ||
}, | ||
Err(_) => { | ||
warning(format!("Failed to find the Steam directory at '{}'", potental_path)); | ||
return "null".parse().unwrap(); | ||
} | ||
} | ||
} |