aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeckoEidechse <gecko.eidechse+git@pm.me>2023-07-18 14:16:18 +0200
committerGeckoEidechse <gecko.eidechse+git@pm.me>2023-07-18 14:16:18 +0200
commit6d0d813c9af9fb43e2732652c5ec14d914dcea42 (patch)
tree7c544d516ede038750f696bc9eec66de70e5867d
parentdfa5af1746546d388a85081fae499c28521a20ea (diff)
downloadFlightCore-6d0d813c9af9fb43e2732652c5ec14d914dcea42.tar.gz
FlightCore-6d0d813c9af9fb43e2732652c5ec14d914dcea42.zip
feat: Initial support for installing packages
-rw-r--r--src-tauri/Cargo.lock46
-rw-r--r--src-tauri/Cargo.toml2
-rw-r--r--src-tauri/src/mod_management/mod.rs11
3 files changed, 44 insertions, 15 deletions
diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock
index 77064841..a1699c16 100644
--- a/src-tauri/Cargo.lock
+++ b/src-tauri/Cargo.lock
@@ -45,6 +45,15 @@ dependencies = [
]
[[package]]
+name = "aho-corasick"
+version = "1.0.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "43f6cb1bf222025340178f382c426f13757b2960e89779dfcb319c32542a5a41"
+dependencies = [
+ "memchr",
+]
+
+[[package]]
name = "alloc-no-stdlib"
version = "2.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -1453,7 +1462,7 @@ version = "0.4.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "029d74589adefde59de1a0c4f4732695c32805624aec7b68d91503d4dba79afc"
dependencies = [
- "aho-corasick",
+ "aho-corasick 0.7.20",
"bstr",
"fnv",
"log",
@@ -1983,11 +1992,12 @@ checksum = "201de327520df007757c1f0adce6e827fe8562fbc28bfd9c15571c66ca1f5f79"
[[package]]
name = "libthermite"
-version = "0.6.5"
+version = "0.7.0-alpha"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "27cd844bbc25676cd14fa9ad04cc40e0f3c4d5c66107ef3a99896db1f81324c0"
+checksum = "b3927ebe9945316ba6a70f4384045fba7da9261e23b44faa7fddf9238f8916fa"
dependencies = [
"json5",
+ "regex",
"serde",
"serde_json",
"thiserror",
@@ -2114,7 +2124,7 @@ version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8263075bb86c5a1b1427b5ae862e8889656f126e9f77c484496e8b47cf5c5558"
dependencies = [
- "regex-automata",
+ "regex-automata 0.1.10",
]
[[package]]
@@ -3055,13 +3065,14 @@ dependencies = [
[[package]]
name = "regex"
-version = "1.7.1"
+version = "1.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "48aaa5748ba571fb95cd2c85c09f629215d3a6ece942baa100950af03a34f733"
+checksum = "b2eae68fc220f7cf2532e4494aded17545fce192d59cd996e0fe7887f4ceb575"
dependencies = [
- "aho-corasick",
+ "aho-corasick 1.0.2",
"memchr",
- "regex-syntax",
+ "regex-automata 0.3.3",
+ "regex-syntax 0.7.4",
]
[[package]]
@@ -3070,7 +3081,18 @@ version = "0.1.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132"
dependencies = [
- "regex-syntax",
+ "regex-syntax 0.6.28",
+]
+
+[[package]]
+name = "regex-automata"
+version = "0.3.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "39354c10dd07468c2e73926b23bb9c2caca74c5501e38a35da70406f1d923310"
+dependencies = [
+ "aho-corasick 1.0.2",
+ "memchr",
+ "regex-syntax 0.7.4",
]
[[package]]
@@ -3080,6 +3102,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "456c603be3e8d448b072f410900c09faf164fbce2d480456f50eea6e25f9c848"
[[package]]
+name = "regex-syntax"
+version = "0.7.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e5ea92a5b6195c6ef2a0295ea818b312502c6fc94dde986c5553242e18fd4ce2"
+
+[[package]]
name = "reqwest"
version = "0.11.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml
index ed523a4b..1ce47b8a 100644
--- a/src-tauri/Cargo.toml
+++ b/src-tauri/Cargo.toml
@@ -33,7 +33,7 @@ steamlocate = "1.2"
# Error messages
anyhow = "1.0"
# libthermite for Northstar/mod install handling
-libthermite = "0.6.5"
+libthermite = "0.7.0-alpha"
# zip stuff
zip = "0.6.2"
# Regex
diff --git a/src-tauri/src/mod_management/mod.rs b/src-tauri/src/mod_management/mod.rs
index 825cba37..adc46661 100644
--- a/src-tauri/src/mod_management/mod.rs
+++ b/src-tauri/src/mod_management/mod.rs
@@ -285,7 +285,6 @@ pub async fn fc_download_mod_and_install(
"{}/___flightcore-temp-download-dir/",
game_install.game_path
);
- let mods_directory = format!("{}/R2Northstar/mods/", game_install.game_path);
// Early return on empty string
if thunderstore_mod_string.is_empty() {
@@ -350,14 +349,16 @@ pub async fn fc_download_mod_and_install(
Err(err) => return Err(err.to_string()),
};
- // Get Thunderstore mod author
- let author = thunderstore_mod_string.split('-').next().unwrap();
+ // Get directory to install to made up of packages directory and Thunderstore mod string
+ let install_directory = format!(
+ "{}/R2Northstar/packages/{}",
+ game_install.game_path, thunderstore_mod_string
+ );
// Extract the mod to the mods directory
match thermite::core::manage::install_mod(
- author,
temp_file.file(),
- std::path::Path::new(&mods_directory),
+ std::path::Path::new(&install_directory),
) {
Ok(_) => (),
Err(err) => {