Clippy fixes for windows specific code (#319)

* Clippy fixes for windows specific code

* Remove unwraps in windows code

* Fix compile error on unix
This commit is contained in:
Philip Kristoffersen
2023-01-08 14:02:40 +01:00
committed by GitHub
parent 7dfbc01ed2
commit 0410ceffff
6 changed files with 26 additions and 23 deletions
+8 -6
View File
@@ -85,12 +85,14 @@ pub fn get_default_location() -> String {
#[cfg(target_os = "windows")]
pub fn get_default_location() -> String {
let key = "APPDATA";
let appdata = std::env::var(key).expect("Expected a APPDATA variable to be defined");
Path::new(&appdata)
.join("itch")
.to_str()
.unwrap()
.to_string()
std::env::var(key)
.map(|appdata| {
Path::new(&appdata)
.join("itch")
.to_string_lossy()
.to_string()
})
.unwrap_or_default()
//C:\Users\phili\AppData\Local\itch
}