aboutsummaryrefslogtreecommitdiff
path: root/src-tauri/src/mod_management
diff options
context:
space:
mode:
Diffstat (limited to 'src-tauri/src/mod_management')
-rw-r--r--src-tauri/src/mod_management/legacy.rs2
-rw-r--r--src-tauri/src/mod_management/mod.rs35
2 files changed, 29 insertions, 8 deletions
diff --git a/src-tauri/src/mod_management/legacy.rs b/src-tauri/src/mod_management/legacy.rs
index 91463250..1e9f90f5 100644
--- a/src-tauri/src/mod_management/legacy.rs
+++ b/src-tauri/src/mod_management/legacy.rs
@@ -45,7 +45,7 @@ fn parse_for_thunderstore_mod_string(nsmod_path: &str) -> Result<String, anyhow:
pub fn parse_installed_mods(
game_install: &GameInstall,
) -> Result<Vec<NorthstarMod>, anyhow::Error> {
- let ns_mods_folder = format!("{}/R2Northstar/mods/", game_install.game_path);
+ let ns_mods_folder = format!("{}/{}/mods/", game_install.game_path, game_install.profile);
let paths = match std::fs::read_dir(ns_mods_folder) {
Ok(paths) => paths,
diff --git a/src-tauri/src/mod_management/mod.rs b/src-tauri/src/mod_management/mod.rs
index 879d3b04..a5f928bd 100644
--- a/src-tauri/src/mod_management/mod.rs
+++ b/src-tauri/src/mod_management/mod.rs
@@ -91,7 +91,10 @@ impl std::ops::Deref for TempFile {
/// Returns a serde json object of the parsed `enabledmods.json` file
pub fn get_enabled_mods(game_install: &GameInstall) -> Result<serde_json::value::Value, String> {
- let enabledmods_json_path = format!("{}/R2Northstar/enabledmods.json", game_install.game_path);
+ let enabledmods_json_path = format!(
+ "{}/{}/enabledmods.json",
+ game_install.game_path, game_install.profile
+ );
// Check for JSON file
if !std::path::Path::new(&enabledmods_json_path).exists() {
@@ -116,7 +119,10 @@ pub fn get_enabled_mods(game_install: &GameInstall) -> Result<serde_json::value:
/// Gets all currently installed and enabled/disabled mods to rebuild `enabledmods.json`
pub fn rebuild_enabled_mods_json(game_install: &GameInstall) -> Result<(), String> {
- let enabledmods_json_path = format!("{}/R2Northstar/enabledmods.json", game_install.game_path);
+ let enabledmods_json_path = format!(
+ "{}/{}/enabledmods.json",
+ game_install.game_path, game_install.profile
+ );
let mods_and_properties = get_installed_mods_and_properties(game_install.clone())?;
// Create new mapping
@@ -147,7 +153,10 @@ pub fn set_mod_enabled_status(
mod_name: String,
is_enabled: bool,
) -> Result<(), String> {
- let enabledmods_json_path = format!("{}/R2Northstar/enabledmods.json", game_install.game_path);
+ let enabledmods_json_path = format!(
+ "{}/{}/enabledmods.json",
+ game_install.game_path, game_install.profile
+ );
// Parse JSON
let mut res: serde_json::Value = match get_enabled_mods(&game_install) {
@@ -260,7 +269,10 @@ pub fn parse_installed_package_mods(
) -> Result<Vec<NorthstarMod>, anyhow::Error> {
let mut collected_mods: Vec<NorthstarMod> = Vec::new();
- let packages_folder = format!("{}/R2Northstar/packages/", game_install.game_path);
+ let packages_folder = format!(
+ "{}/{}/packages/",
+ game_install.game_path, game_install.profile
+ );
let packages_dir = match fs::read_dir(packages_folder) {
Ok(res) => res,
@@ -420,7 +432,10 @@ fn delete_older_versions(
"Deleting other versions of {}",
thunderstore_mod_string.to_string()
);
- let packages_folder = format!("{}/R2Northstar/packages", game_install.game_path);
+ let packages_folder = format!(
+ "{}/{}/packages",
+ game_install.game_path, game_install.profile
+ );
// Get folders in packages dir
let paths = match std::fs::read_dir(&packages_folder) {
@@ -590,7 +605,10 @@ pub async fn fc_download_mod_and_install(
};
// Get directory to install to made up of packages directory and Thunderstore mod string
- let install_directory = format!("{}/R2Northstar/packages/", game_install.game_path);
+ let install_directory = format!(
+ "{}/{}/packages/",
+ game_install.game_path, game_install.profile
+ );
// Extract the mod to the mods directory
match thermite::core::manage::install_with_sanity(
@@ -703,7 +721,10 @@ pub fn delete_thunderstore_mod(
thunderstore_mod_string: String,
) -> Result<(), String> {
// Check packages
- let packages_folder = format!("{}/R2Northstar/packages", game_install.game_path);
+ let packages_folder = format!(
+ "{}/{}/packages",
+ game_install.game_path, game_install.profile
+ );
if std::path::Path::new(&packages_folder).exists() {
for entry in fs::read_dir(packages_folder).unwrap() {
let entry = entry.unwrap();