diff options
author | GeckoEidechse <gecko.eidechse+git@pm.me> | 2023-08-03 19:46:54 +0200 |
---|---|---|
committer | GeckoEidechse <gecko.eidechse+git@pm.me> | 2023-08-03 19:46:54 +0200 |
commit | 439574d9b7f2ac4a95d97cb56e57cf152bb01ad2 (patch) | |
tree | 937bad8bc0e7c443c7576046dc3afef70d0d0e59 | |
parent | 869300c848429d18734fd0d02f4c277f21357568 (diff) | |
parent | efb193b517087d47f30f0542517c389bbfe5cde1 (diff) | |
download | FlightCore-439574d9b7f2ac4a95d97cb56e57cf152bb01ad2.tar.gz FlightCore-439574d9b7f2ac4a95d97cb56e57cf152bb01ad2.zip |
Merge branch 'main' into feat/launch-parameters
-rw-r--r-- | src-tauri/Cargo.lock | 2 | ||||
-rw-r--r-- | src-tauri/Cargo.toml | 2 | ||||
-rw-r--r-- | src-tauri/src/github/pull_requests.rs | 20 | ||||
-rw-r--r-- | src-tauri/src/repair_and_verify/mod.rs | 8 | ||||
-rw-r--r-- | src-tauri/tauri.conf.json | 2 | ||||
-rw-r--r-- | src-vue/src/plugins/modules/pull_requests.ts | 4 |
6 files changed, 22 insertions, 16 deletions
diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock index f4d1faab..6bcfbeb3 100644 --- a/src-tauri/Cargo.lock +++ b/src-tauri/Cargo.lock @@ -81,7 +81,7 @@ checksum = "3b13c32d80ecc7ab747b80c3784bce54ee8a7a0cc4fbda9bf4cda2cf6fe90854" [[package]] name = "app" -version = "2.4.0" +version = "2.4.1" dependencies = [ "anyhow", "async-recursion", diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index 6341d9a1..bb2cc525 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "app" -version = "2.4.0" +version = "2.4.1" description = "A Tauri App" authors = ["you"] license = "" diff --git a/src-tauri/src/github/pull_requests.rs b/src-tauri/src/github/pull_requests.rs index c3079cfd..ccb45dff 100644 --- a/src-tauri/src/github/pull_requests.rs +++ b/src-tauri/src/github/pull_requests.rs @@ -2,6 +2,7 @@ use crate::github::release_notes::fetch_github_releases_api; use crate::check_is_valid_game_path; use crate::constants::{APP_USER_AGENT, PULLS_API_ENDPOINT_LAUNCHER, PULLS_API_ENDPOINT_MODS}; +use crate::GameInstall; use anyhow::anyhow; use serde::{Deserialize, Serialize}; use std::fs::File; @@ -231,10 +232,10 @@ fn add_batch_file(game_install_path: &str) { #[tauri::command] pub async fn apply_launcher_pr( pull_request: PullsApiResponseElement, - game_install_path: &str, + game_install: GameInstall, ) -> Result<(), String> { // Exit early if wrong game path - check_is_valid_game_path(game_install_path)?; + check_is_valid_game_path(&game_install.game_path)?; // get download link let download_url = match get_launcher_download_link(pull_request.head.sha.clone()).await { @@ -254,7 +255,7 @@ pub async fn apply_launcher_pr( let extract_directory = format!( "{}/___flightcore-temp/download-dir/launcher-pr-{}", - game_install_path, pull_request.number + game_install.game_path, pull_request.number ); match std::fs::create_dir_all(extract_directory.clone()) { Ok(_) => (), @@ -281,7 +282,7 @@ pub async fn apply_launcher_pr( let files_to_copy = vec!["NorthstarLauncher.exe", "Northstar.dll"]; for file_name in files_to_copy { let source_file_path = format!("{}/{}", extract_directory, file_name); - let destination_file_path = format!("{}/{}", game_install_path, file_name); + let destination_file_path = format!("{}/{}", game_install.game_path, file_name); match std::fs::copy(source_file_path, destination_file_path) { Ok(_result) => (), Err(err) => { @@ -312,10 +313,10 @@ pub async fn apply_launcher_pr( #[tauri::command] pub async fn apply_mods_pr( pull_request: PullsApiResponseElement, - game_install_path: &str, + game_install: GameInstall, ) -> Result<(), String> { // Exit early if wrong game path - check_is_valid_game_path(game_install_path)?; + check_is_valid_game_path(&game_install.game_path)?; let download_url = match get_mods_download_link(pull_request) { Ok(url) => url, @@ -327,7 +328,10 @@ pub async fn apply_mods_pr( Err(err) => return Err(err.to_string()), }; - let profile_folder = format!("{}/R2Northstar-PR-test-managed-folder", game_install_path); + let profile_folder = format!( + "{}/R2Northstar-PR-test-managed-folder", + game_install.game_path + ); // Delete previously managed folder if std::fs::remove_dir_all(profile_folder.clone()).is_err() { @@ -352,7 +356,7 @@ pub async fn apply_mods_pr( } }; // Add batch file to launch right profile - add_batch_file(game_install_path); + add_batch_file(&game_install.game_path); log::info!("All done with installing mods PR"); Ok(()) diff --git a/src-tauri/src/repair_and_verify/mod.rs b/src-tauri/src/repair_and_verify/mod.rs index 29cc9613..8b68ce59 100644 --- a/src-tauri/src/repair_and_verify/mod.rs +++ b/src-tauri/src/repair_and_verify/mod.rs @@ -1,7 +1,6 @@ use crate::mod_management::{get_enabled_mods, rebuild_enabled_mods_json, set_mod_enabled_status}; /// Contains various functions to repair common issues and verifying installation use crate::{constants::CORE_MODS, GameInstall}; -use anyhow::anyhow; /// Verifies Titanfall2 game files #[tauri::command] @@ -40,9 +39,10 @@ pub fn clean_up_download_folder( game_install: &GameInstall, force: bool, ) -> Result<(), anyhow::Error> { - const TEMPORARY_DIRECTORIES: [&str; 3] = [ + const TEMPORARY_DIRECTORIES: [&str; 4] = [ "___flightcore-temp-download-dir", "___flightcore-temp/download-dir", + "___flightcore-temp/extract-dir", "___flightcore-temp", ]; @@ -58,7 +58,9 @@ pub fn clean_up_download_folder( download_dir_contents.for_each(|_| count += 1); if count > 0 && !force { - return Err(anyhow!("Folder not empty, not deleting")); + // Skip folder if not empty + log::warn!("Folder not empty, not deleting: {directory}"); + continue; } // Delete folder diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index b5b5b6f7..10610bbe 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -8,7 +8,7 @@ }, "package": { "productName": "FlightCore", - "version": "2.4.0" + "version": "2.4.1" }, "tauri": { "allowlist": { diff --git a/src-vue/src/plugins/modules/pull_requests.ts b/src-vue/src/plugins/modules/pull_requests.ts index 3f3ba259..4caec0b0 100644 --- a/src-vue/src/plugins/modules/pull_requests.ts +++ b/src-vue/src/plugins/modules/pull_requests.ts @@ -54,7 +54,7 @@ export const pullRequestModule = { // Send notification telling the user to wait for the process to finish const notification = showNotification(`Installing launcher PR ${pull_request.number}`, 'Please wait', 'info', 0); - await invoke("apply_launcher_pr", { pullRequest: pull_request, gameInstallPath: store.state.game_install.game_path }) + await invoke("apply_launcher_pr", { pullRequest: pull_request, gameInstall: store.state.game_install }) .then((message) => { console.log(message); // Show user notification if mod install completed. @@ -72,7 +72,7 @@ export const pullRequestModule = { // Send notification telling the user to wait for the process to finish const notification = showNotification(`Installing mods PR ${pull_request.number}`, 'Please wait', 'info', 0); - await invoke("apply_mods_pr", { pullRequest: pull_request, gameInstallPath: store.state.game_install.game_path }) + await invoke("apply_mods_pr", { pullRequest: pull_request, gameInstall: store.state.game_install }) .then((message) => { // Show user notification if mod install completed. showNotification( |