diff --git a/src/egs/epic_platform.rs b/src/egs/epic_platform.rs index a6bb5ab..c8ac7fa 100644 --- a/src/egs/epic_platform.rs +++ b/src/egs/epic_platform.rs @@ -28,7 +28,7 @@ impl Platform for EpicPlatform { get_egs_manifests(&self.settings) } - #[cfg(target_os = "linux")] + #[cfg(target_family = "unix")] fn create_symlinks(&self) -> bool { self.settings.create_symlinks } diff --git a/src/egs/get_manifests.rs b/src/egs/get_manifests.rs index ef3a5b2..3369f01 100644 --- a/src/egs/get_manifests.rs +++ b/src/egs/get_manifests.rs @@ -74,7 +74,7 @@ fn get_manifest_dir_path( } pub fn get_default_location() -> Option { - #[cfg(target_os = "linux")] + #[cfg(target_family = "unix")] { //No path defined for epic gamestore, and we cannot guess on linux None diff --git a/src/egs/manifest_item.rs b/src/egs/manifest_item.rs index d1e65bc..29dc4c4 100644 --- a/src/egs/manifest_item.rs +++ b/src/egs/manifest_item.rs @@ -148,7 +148,7 @@ mod tests { #[cfg(target_os = "windows")] assert_eq!(shortcut.exe, "\"C:\\Games\\MarvelGOTG\\retail/gotg.exe\""); - #[cfg(target_os = "linux")] + #[cfg(target_family = "unix")] assert_eq!(shortcut.exe, "\"C:\\Games\\MarvelGOTG/retail/gotg.exe\""); assert_eq!(shortcut.launch_options, ""); diff --git a/src/egs/settings.rs b/src/egs/settings.rs index 4ef50fd..9d04c72 100644 --- a/src/egs/settings.rs +++ b/src/egs/settings.rs @@ -5,6 +5,6 @@ pub struct EpicGamesLauncherSettings { pub enabled: bool, pub location: Option, - #[cfg(target_os = "linux")] + #[cfg(target_family = "unix")] pub create_symlinks: bool, } diff --git a/src/gog/gog_platform.rs b/src/gog/gog_platform.rs index 68c4e3a..5114deb 100644 --- a/src/gog/gog_platform.rs +++ b/src/gog/gog_platform.rs @@ -21,7 +21,7 @@ impl Platform for GogPlatform { "Gog" } - #[cfg(target_os = "linux")] + #[cfg(target_family = "unix")] fn create_symlinks(&self) -> bool { self.settings.create_symlinks } @@ -41,7 +41,7 @@ impl Platform for GogPlatform { return Err(GogErrors::ConfigFileNotFound { path: config_path }); } let install_locations = get_install_locations(config_path)?; - #[cfg(target_os = "linux")] + #[cfg(target_family = "unix")] let install_locations = if let Some(wine_c_drive) = &self.settings.wine_c_drive { fix_paths(wine_c_drive, install_locations) } else { @@ -113,12 +113,12 @@ impl Platform for GogPlatform { None => folder_path.to_string(), }; - #[cfg(target_os = "linux")] + #[cfg(target_family = "unix")] let working_dir = working_dir.replace("\\", "/"); let full_path_string = full_path.to_string(); - #[cfg(target_os = "linux")] + #[cfg(target_family = "unix")] let full_path_string = full_path_string.replace("\\", "/"); let shortcut = GogShortcut { @@ -151,7 +151,7 @@ impl Platform for GogPlatform { } } -#[cfg(target_os = "linux")] +#[cfg(target_family = "unix")] fn fix_paths(wine_c_drive: &str, paths: Vec) -> Vec { paths .iter() @@ -191,7 +191,7 @@ pub fn default_location() -> PathBuf { let program_data = std::env::var(key).expect("Expected a APPDATA variable to be defined"); Path::new(&program_data).join("GOG.com").join("Galaxy") } - #[cfg(target_os = "linux")] + #[cfg(target_family = "unix")] { let home = std::env::var("HOME").expect("Expected a home variable to be defined"); Path::new(&home).join("Games/gog-galaxy/drive_c/ProgramData/GOG.com/Galaxy") diff --git a/src/gog/gog_settings.rs b/src/gog/gog_settings.rs index 6c0cb61..5ff8ce4 100644 --- a/src/gog/gog_settings.rs +++ b/src/gog/gog_settings.rs @@ -5,6 +5,6 @@ pub struct GogSettings { pub enabled: bool, pub location: Option, pub wine_c_drive: Option, - #[cfg(target_os = "linux")] + #[cfg(target_family = "unix")] pub create_symlinks: bool, } diff --git a/src/itch/itch_platform.rs b/src/itch/itch_platform.rs index ea4fb7e..f8d62e3 100644 --- a/src/itch/itch_platform.rs +++ b/src/itch/itch_platform.rs @@ -55,7 +55,7 @@ impl Platform for ItchPlatform { Ok(res) } - #[cfg(target_os = "linux")] + #[cfg(target_family = "unix")] fn create_symlinks(&self) -> bool { self.settings.create_symlinks } @@ -92,7 +92,7 @@ fn dbpath_to_game(paths: &DbPaths<'_>) -> Option { }) } -#[cfg(target_os = "linux")] +#[cfg(target_family = "unix")] pub fn get_default_location() -> String { //If we don't have a home drive we have to just die let home = std::env::var("HOME").expect("Expected a home variable to be defined"); diff --git a/src/itch/settings.rs b/src/itch/settings.rs index 35526f2..5403fe7 100644 --- a/src/itch/settings.rs +++ b/src/itch/settings.rs @@ -4,6 +4,6 @@ use serde::{Deserialize, Serialize}; pub struct ItchSettings { pub enabled: bool, pub location: Option, - #[cfg(target_os = "linux")] + #[cfg(target_family = "unix")] pub create_symlinks: bool, } diff --git a/src/legendary/legendary_platform.rs b/src/legendary/legendary_platform.rs index afd9115..5e025a2 100644 --- a/src/legendary/legendary_platform.rs +++ b/src/legendary/legendary_platform.rs @@ -33,7 +33,7 @@ impl Platform> for LegendaryPlatform { Ok(legendary_ouput) } - #[cfg(target_os = "linux")] + #[cfg(target_family = "unix")] fn create_symlinks(&self) -> bool { false } diff --git a/src/origin/origin_platform.rs b/src/origin/origin_platform.rs index 7c14148..713c501 100644 --- a/src/origin/origin_platform.rs +++ b/src/origin/origin_platform.rs @@ -21,7 +21,7 @@ impl Platform for OriginPlatform { "Origin" } - #[cfg(target_os = "linux")] + #[cfg(target_family = "unix")] fn create_symlinks(&self) -> bool { false } @@ -106,7 +106,7 @@ fn parse_id_from_file(i: &str) -> nom::IResult<&str, &str> { take_until("&")(i) } -#[cfg(target_os = "linux")] +#[cfg(target_family = "unix")] pub fn get_default_location() -> String { //TODO implement this for linux: // https://www.toptensoftware.com/blog/running-ea-origin-games-under-linux-via-steam-and-proton/ diff --git a/src/platform.rs b/src/platform.rs index 247d5b7..a92e50c 100644 --- a/src/platform.rs +++ b/src/platform.rs @@ -12,7 +12,7 @@ where fn settings_valid(&self) -> SettingsValidity; - #[cfg(target_os = "linux")] + #[cfg(target_family = "unix")] fn create_symlinks(&self) -> bool; } diff --git a/src/steam/utils.rs b/src/steam/utils.rs index 111d946..592bba2 100644 --- a/src/steam/utils.rs +++ b/src/steam/utils.rs @@ -118,6 +118,18 @@ pub fn get_default_location() -> Result> { .unwrap_or(""), ) }; + #[cfg(target_os = "macos")] + let path_string = { + let home = std::env::var("HOME")?; + String::from( + Path::new(&home) + .join("Library") + .join("Application Support") + .join("Steam") + .to_str() + .unwrap_or(""), + ) + }; Ok(path_string) } diff --git a/src/sync/mod.rs b/src/sync/mod.rs index f7dfc0f..eb4f124 100644 --- a/src/sync/mod.rs +++ b/src/sync/mod.rs @@ -1,4 +1,4 @@ -#[cfg(target_os = "linux")] +#[cfg(target_family = "unix")] mod symlinks; mod synchronization; diff --git a/src/sync/synchronization.rs b/src/sync/synchronization.rs index 6da64b3..efa47c4 100644 --- a/src/sync/synchronization.rs +++ b/src/sync/synchronization.rs @@ -63,9 +63,9 @@ fn fix_shortcut_icons(user: &SteamUsersInfo, shortcuts: &mut Vec) .join("config") .join("grid"); for shortcut in shortcuts { - #[cfg(not(target_os = "linux"))] + #[cfg(not(target_family = "unix"))] let replace_icon = shortcut.icon.trim().eq(""); - #[cfg(target_os = "linux")] + #[cfg(target_family = "unix")] let replace_icon = shortcut.icon.trim().eq("") || shortcut.icon.eq(&shortcut.exe); if replace_icon { let app_id = steam_shortcuts_util::app_id_generator::calculate_app_id( @@ -164,7 +164,7 @@ where return; } - #[cfg(target_os = "linux")] + #[cfg(target_family = "unix")] if platform.create_symlinks() { let name = platform.name(); super::symlinks::ensure_links_folder_created(name); @@ -187,7 +187,7 @@ where if !shortcut_owned.tags.contains(&boilr_tag) { shortcut_owned.tags.push(boilr_tag.clone()); } - #[cfg(target_os = "linux")] + #[cfg(target_family = "unix")] let shortcut_owned = if platform.create_symlinks() { crate::sync::symlinks::create_sym_links(&shortcut_owned) } else { diff --git a/src/ui/ui.rs b/src/ui/ui.rs index ca43949..9c60ba0 100644 --- a/src/ui/ui.rs +++ b/src/ui/ui.rs @@ -172,12 +172,12 @@ fn update_ui_with_settings(ui: &mut UserInterface, settings: &Settings) { .unwrap_or(default_gog_location), ); - #[cfg(target_os = "linux")] + #[cfg(target_family = "unix")] { ui.gog_winedrive_input .set_value(&settings.gog.wine_c_drive.clone().unwrap_or("".to_string())); } - #[cfg(not(target_os = "linux"))] + #[cfg(not(target_family = "unix"))] { ui.gog_winedrive_input.deactivate(); } diff --git a/src/uplay/platform.rs b/src/uplay/platform.rs index 53063d6..33095be 100644 --- a/src/uplay/platform.rs +++ b/src/uplay/platform.rs @@ -9,7 +9,7 @@ pub struct Uplay { impl Platform> for Uplay { fn enabled(&self) -> bool { - #[cfg(target_os = "linux")] + #[cfg(target_family = "unix")] { false } @@ -28,7 +28,7 @@ impl Platform> for Uplay { } fn get_shortcuts(&self) -> Result, Box> { - #[cfg(target_os = "linux")] + #[cfg(target_family = "unix")] { Ok(vec![]) } @@ -38,7 +38,7 @@ impl Platform> for Uplay { } } - #[cfg(target_os = "linux")] + #[cfg(target_family = "unix")] fn create_symlinks(&self) -> bool { false }