Skip to content

Commit

Permalink
improv: support mac paths
Browse files Browse the repository at this point in the history
  • Loading branch information
imLinguin committed Mar 27, 2024
1 parent 5224dbb commit 97737f9
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/import_parsers/heroic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,12 @@ fn get_config_path() -> Option<path::PathBuf> {
Some(appdata.join("heroic/gog_store/auth.json"))
}

// TODO: Support Mac
#[cfg(target_os = "macos")]
fn get_config_path() -> Option<path::PathBuf> {
let app_support = env::var("HOME").unwrap();
let app_support = path::Path::new(&app_support).join("Library/Application Support");
Some(app_support.join("heroic/gog_store/auth.json"))
}

pub fn load_tokens() -> HeroicAuthConfig {
let config_path = get_config_path().expect("No heroic's auth.json found");
Expand Down
6 changes: 6 additions & 0 deletions src/paths.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ lazy_static! {
static ref DATA_PATH: PathBuf = PathBuf::from(env::var("LOCALAPPDATA").unwrap()).join("comet");
}

#[cfg(target_os = "macos")]
lazy_static! {
static ref DATA_PATH: PathBuf =
PathBuf::from(env::var("HOME").unwrap()).join("Library/Application Support");
}

lazy_static! {
pub static ref GAMEPLAY_STORAGE: PathBuf = DATA_PATH.join("gameplay");
}

0 comments on commit 97737f9

Please sign in to comment.