aboutsummaryrefslogtreecommitdiff
path: root/src-tauri/src/northstar/install.rs
diff options
context:
space:
mode:
authorJan <sentrycraft123@gmail.com>2023-08-04 13:31:49 +0200
committerGitHub <noreply@github.com>2023-08-04 13:31:49 +0200
commit2d781b9f694de66fdb23a28d7483b9639e6306d8 (patch)
tree8d88c6489b4878a429477f6942a02d4653cdcf92 /src-tauri/src/northstar/install.rs
parentbfcb0a7f689148330f866c47dc34c6c5e2565592 (diff)
downloadFlightCore-2d781b9f694de66fdb23a28d7483b9639e6306d8.tar.gz
FlightCore-2d781b9f694de66fdb23a28d7483b9639e6306d8.zip
Move DLL into Profile for non default Profiles (#465)
This is done so that with profiles we can run different versions of Northstar which would use different versions of the `Northstar.dll`
Diffstat (limited to 'src-tauri/src/northstar/install.rs')
-rw-r--r--src-tauri/src/northstar/install.rs23
1 files changed, 22 insertions, 1 deletions
diff --git a/src-tauri/src/northstar/install.rs b/src-tauri/src/northstar/install.rs
index 80425c56..c1ae2a80 100644
--- a/src-tauri/src/northstar/install.rs
+++ b/src-tauri/src/northstar/install.rs
@@ -4,7 +4,7 @@ use std::time::Duration;
use std::{cell::RefCell, time::Instant};
use ts_rs::TS;
-use crate::constants::TITANFALL2_STEAM_ID;
+use crate::constants::{NORTHSTAR_DEFAULT_PROFILE, NORTHSTAR_DLL, TITANFALL2_STEAM_ID};
use crate::{
util::{extract, move_dir_all},
GameInstall, InstallType,
@@ -96,6 +96,27 @@ async fn do_install(
log::info!("Extracting Northstar...");
extract(nfile, std::path::Path::new(&extract_directory))?;
+ // Prepare Northstar for Installation
+ log::info!("Preparing Northstar...");
+ if game_install.profile != NORTHSTAR_DEFAULT_PROFILE {
+ // We are using a non standard Profile, we must:
+ // - move the DLL
+ // - rename the Profile
+
+ // Move DLL into the default R2Northstar Profile
+ let old_dll_path = format!("{}/{}", extract_directory, NORTHSTAR_DLL);
+ let new_dll_path = format!(
+ "{}/{}/{}",
+ extract_directory, NORTHSTAR_DEFAULT_PROFILE, NORTHSTAR_DLL
+ );
+ std::fs::rename(old_dll_path, new_dll_path)?;
+
+ // rename default R2Northstar Profile to the profile we want to use
+ let old_profile_path = format!("{}/{}/", extract_directory, NORTHSTAR_DEFAULT_PROFILE);
+ let new_profile_path = format!("{}/{}/", extract_directory, game_install.profile);
+ std::fs::rename(old_profile_path, new_profile_path)?;
+ }
+
log::info!("Installing Northstar...");
for entry in std::fs::read_dir(extract_directory).unwrap() {