From 97737f91c00f540a57b3a06093a83cd2694d7972 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Lidwin?= Date: Wed, 27 Mar 2024 18:42:52 +0100 Subject: [PATCH] improv: support mac paths --- src/import_parsers/heroic.rs | 7 ++++++- src/paths.rs | 6 ++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/import_parsers/heroic.rs b/src/import_parsers/heroic.rs index 6912755..50d9fc4 100644 --- a/src/import_parsers/heroic.rs +++ b/src/import_parsers/heroic.rs @@ -40,7 +40,12 @@ fn get_config_path() -> Option { Some(appdata.join("heroic/gog_store/auth.json")) } -// TODO: Support Mac +#[cfg(target_os = "macos")] +fn get_config_path() -> Option { + 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"); diff --git a/src/paths.rs b/src/paths.rs index 45dc04b..328948d 100644 --- a/src/paths.rs +++ b/src/paths.rs @@ -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"); }