Set origin compat folder

This commit is contained in:
Philip Kristoffersen
2022-05-15 17:08:09 +02:00
parent eaa7d8cc34
commit 2c89a857da
2 changed files with 12 additions and 5 deletions
+8 -4
View File
@@ -7,15 +7,19 @@ pub struct OriginGame {
pub id: String,
pub title: String,
pub origin_location: Option<PathBuf>,
pub origin_compat_folder: Option<PathBuf>,
}
impl From<OriginGame> for ShortcutOwned {
fn from(game: OriginGame) -> Self {
let launch = format!(
let launch = match game.origin_compat_folder{
Some(compat_folder) =>
format!("STEAM_COMPAT_DATA_PATH=\"{}\" %command% \"origin2://game/launch?offerIds={}&autoDownload=1&authCode=&cmdParams=\"", compat_folder.to_string_lossy().to_string(), game.id)
,
None => format!(
"\"origin2://game/launch?offerIds={}&autoDownload=1&authCode=&cmdParams=\"",
game.id
);
game.id)
};
let mut owned_shortcut = if let Some(origin_location) = game.origin_location {
let origin_location = format!("\"{}\"", origin_location.to_string_lossy());
Shortcut::new(
+4 -1
View File
@@ -57,6 +57,7 @@ impl Platform<OriginGame, OriginErrors> for OriginPlatform {
id,
title: game_title,
origin_location: origin_exe.clone(),
origin_compat_folder: origin_folders.compat_folder.clone(),
})
});
Ok(games.collect())
@@ -77,7 +78,6 @@ impl Platform<OriginGame, OriginErrors> for OriginPlatform {
return false;
#[cfg(target_family = "unix")]
{
//TODO Update this when origin gets support on linux
true
}
}
@@ -118,6 +118,8 @@ struct OriginPathData {
exe_path: Option<PathBuf>,
//~/.steam/steam/steamapps/compatdata/X/pfx/drive_c/ProgramData/Origin/LocalContent
local_content_path: Option<PathBuf>,
//~/.steam/steam/steamapps/compatdata/X
compat_folder: Option<PathBuf>,
}
#[cfg(target_family = "unix")]
@@ -150,6 +152,7 @@ fn get_default_locations() -> OriginPathData {
if origin_exe_path.exists() && origin_local_content.exists() {
res.exe_path = Some(origin_exe_path);
res.local_content_path = Some(origin_local_content);
res.compat_folder = Some(dir.path().to_path_buf());
}
}
}