Skip to content

Commit

Permalink
get respect XDG_CONFIG_HOME when getting config dir (required for fla…
Browse files Browse the repository at this point in the history
…tpak) (#18)
  • Loading branch information
slonkazoid authored Jan 16, 2025
1 parent 092a1a2 commit 07109ca
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions crates/libmoonlight/src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,7 @@ pub fn get_moonlight_dir() -> PathBuf {
let home = std::env::var("HOME").unwrap();
PathBuf::from(home).join("Library/Application Support/moonlight-mod")
}
"linux" => {
let home = std::env::var("HOME").unwrap();
PathBuf::from(home).join(".config/moonlight-mod")
}
"linux" => get_dot_config().join("moonlight-mod"),
_ => unimplemented!("Unsupported OS"),
})
})
Expand Down Expand Up @@ -103,3 +100,9 @@ pub fn get_local_share() -> PathBuf {
.map(PathBuf::from)
.unwrap_or_else(|| get_home_dir().join(".local/share"))
}

pub fn get_dot_config() -> PathBuf {
std::env::var_os("XDG_CONFIG_HOME")
.map(PathBuf::from)
.unwrap_or_else(|| get_home_dir().join(".config"))
}

0 comments on commit 07109ca

Please sign in to comment.