aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src-tauri/src/main.rs
diff options
context:
space:
mode:
authorHsiangNianian <i@jyunko.cn>2026-01-14 16:44:56 +0800
committerHsiangNianian <i@jyunko.cn>2026-01-14 16:44:56 +0800
commit9193112aca842dbe4d723aa865a7a30f3bcdb691 (patch)
tree226a595587569c4a4ddb42729163060f4e04dc18 /src-tauri/src/main.rs
parentbdbed80e0ee632a6495244b0a56f74ed6f9d639e (diff)
downloadDropOut-9193112aca842dbe4d723aa865a7a30f3bcdb691.tar.gz
DropOut-9193112aca842dbe4d723aa865a7a30f3bcdb691.zip
refactor: clean up formatting and improve readability in core modules
Diffstat (limited to 'src-tauri/src/main.rs')
-rw-r--r--src-tauri/src/main.rs35
1 files changed, 16 insertions, 19 deletions
diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs
index 2261273..ba16f7a 100644
--- a/src-tauri/src/main.rs
+++ b/src-tauri/src/main.rs
@@ -41,7 +41,7 @@ impl MsRefreshTokenState {
}
/// Check if a string contains unresolved placeholders in the form ${...}
-///
+///
/// After the replacement phase, if a string still contains ${...}, it means
/// that placeholder variable was not found in the replacements map and is
/// therefore unresolved. We should skip adding such arguments to avoid
@@ -119,11 +119,11 @@ async fn start_game(
window,
format!("Loading version details for {}...", version_id)
);
-
+
let version_details = core::manifest::load_version(&game_dir, &version_id)
.await
.map_err(|e| e.to_string())?;
-
+
emit_log!(
window,
format!(
@@ -145,7 +145,9 @@ async fn start_game(
// --- Client Jar ---
// Get downloads from version_details (may be inherited)
- let downloads = version_details.downloads.as_ref()
+ let downloads = version_details
+ .downloads
+ .as_ref()
.ok_or("Version has no downloads information")?;
let client_jar = &downloads.client;
let mut client_path = game_dir.join("versions");
@@ -222,12 +224,11 @@ async fn start_game(
} else {
// 3. Library without explicit downloads (mod loader libraries)
// Use Maven coordinate resolution
- if let Some(url) = core::maven::resolve_library_url(
- &lib.name,
- None,
- lib.url.as_deref(),
- ) {
- if let Some(lib_path) = core::maven::get_library_path(&lib.name, &libraries_dir) {
+ if let Some(url) =
+ core::maven::resolve_library_url(&lib.name, None, lib.url.as_deref())
+ {
+ if let Some(lib_path) = core::maven::get_library_path(&lib.name, &libraries_dir)
+ {
download_tasks.push(core::downloader::DownloadTask {
url,
path: lib_path,
@@ -246,7 +247,9 @@ async fn start_game(
let indexes_dir = assets_dir.join("indexes");
// Get asset index (may be inherited from parent)
- let asset_index = version_details.asset_index.as_ref()
+ let asset_index = version_details
+ .asset_index
+ .as_ref()
.ok_or("Version has no asset index information")?;
// Download Asset Index JSON
@@ -262,10 +265,7 @@ async fn start_game(
.await
.map_err(|e| e.to_string())?
} else {
- println!(
- "Downloading asset index from {}",
- asset_index.url
- );
+ println!("Downloading asset index from {}", asset_index.url);
let content = reqwest::get(&asset_index.url)
.await
.map_err(|e| e.to_string())?
@@ -426,10 +426,7 @@ async fn start_game(
replacements.insert("${version_name}", version_id.clone());
replacements.insert("${game_directory}", game_dir.to_string_lossy().to_string());
replacements.insert("${assets_root}", assets_dir.to_string_lossy().to_string());
- replacements.insert(
- "${assets_index_name}",
- asset_index.id.clone(),
- );
+ replacements.insert("${assets_index_name}", asset_index.id.clone());
replacements.insert("${auth_uuid}", account.uuid());
replacements.insert("${auth_access_token}", account.access_token());
replacements.insert("${user_type}", "mojang".to_string());