From 9c366b8d5c3f68d19bb87ed354b42b48c99b66c5 Mon Sep 17 00:00:00 2001 From: HsiangNianian Date: Fri, 16 Jan 2026 14:40:02 +0800 Subject: feat: improve Java command execution on Windows Enhanced the Java command execution by adding support for Windows-specific creation flags in both the installer and candidate checking functions. This change ensures better compatibility and performance when running Java commands on Windows systems. --- src-tauri/src/core/forge.rs | 15 ++++++++++----- src-tauri/src/core/java.rs | 19 ++++++++++++++----- 2 files changed, 24 insertions(+), 10 deletions(-) diff --git a/src-tauri/src/core/forge.rs b/src-tauri/src/core/forge.rs index c8bd6e4..0528b76 100644 --- a/src-tauri/src/core/forge.rs +++ b/src-tauri/src/core/forge.rs @@ -9,6 +9,8 @@ use serde::{Deserialize, Serialize}; use std::error::Error; +#[cfg(target_os = "windows")] +use std::os::windows::process::CommandExt; use std::path::PathBuf; const FORGE_PROMOTIONS_URL: &str = @@ -293,13 +295,16 @@ pub async fn run_forge_installer( // Run the installer in headless mode // The installer accepts --installClient to install to a specific directory - let output = tokio::process::Command::new(java_path) - .arg("-jar") + let mut cmd = tokio::process::Command::new(java_path); + cmd.arg("-jar") .arg(&installer_path) .arg("--installClient") - .arg(game_dir) - .output() - .await?; + .arg(game_dir); + + #[cfg(target_os = "windows")] + cmd.creation_flags(0x08000000); + + let output = cmd.output().await?; // Clean up installer let _ = tokio::fs::remove_file(&installer_path).await; diff --git a/src-tauri/src/core/java.rs b/src-tauri/src/core/java.rs index ac52da6..7aa43b8 100644 --- a/src-tauri/src/core/java.rs +++ b/src-tauri/src/core/java.rs @@ -1,4 +1,6 @@ use serde::{Deserialize, Serialize}; +#[cfg(target_os = "windows")] +use std::os::windows::process::CommandExt; use std::path::PathBuf; use std::process::Command; use tauri::AppHandle; @@ -636,10 +638,12 @@ fn get_java_candidates() -> Vec { let mut candidates = Vec::new(); // Check PATH first - if let Ok(output) = Command::new(if cfg!(windows) { "where" } else { "which" }) - .arg("java") - .output() - { + let mut cmd = Command::new(if cfg!(windows) { "where" } else { "which" }); + cmd.arg("java"); + #[cfg(target_os = "windows")] + cmd.creation_flags(0x08000000); + + if let Ok(output) = cmd.output() { if output.status.success() { let paths = String::from_utf8_lossy(&output.stdout); for line in paths.lines() { @@ -788,7 +792,12 @@ fn get_java_candidates() -> Vec { /// Check a specific Java installation and get its version info fn check_java_installation(path: &PathBuf) -> Option { - let output = Command::new(path).arg("-version").output().ok()?; + let mut cmd = Command::new(path); + cmd.arg("-version"); + #[cfg(target_os = "windows")] + cmd.creation_flags(0x08000000); + + let output = cmd.output().ok()?; // Java outputs version info to stderr let version_output = String::from_utf8_lossy(&output.stderr); -- cgit v1.2.3-70-g09d2 From e3bd439e74d92732107bbce671cbf092ba134ef4 Mon Sep 17 00:00:00 2001 From: HsiangNianian Date: Fri, 16 Jan 2026 14:42:34 +0800 Subject: chore: update version to 0.1.24 in Cargo.toml and tauri.conf.json Bumped the version number in both Cargo.toml and tauri.conf.json to reflect the new release version 0.1.24. --- src-tauri/Cargo.toml | 2 +- src-tauri/tauri.conf.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index 97529a1..5a7cfc8 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "dropout" -version = "0.1.23" +version = "0.1.24" edition = "2021" authors = ["HsiangNianian"] description = "The DropOut Minecraft Game Launcher" diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index 060a871..450990a 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -1,6 +1,6 @@ { "productName": "dropout", - "version": "0.1.23", + "version": "0.1.24", "identifier": "com.dropout.launcher", "build": { "beforeDevCommand": "pnpm -C ../ui dev", -- cgit v1.2.3-70-g09d2 From 0fbb2b7bbc9f69da3977f89fde3143c8f966b2c5 Mon Sep 17 00:00:00 2001 From: HsiangNianian Date: Fri, 16 Jan 2026 14:46:18 +0800 Subject: fix: update project name formatting in README.md Changed the project name from "DropOut" to "Drop*O*ut" in the README file for improved branding consistency. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 5918792..e3841f2 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# DropOut +# Drop*O*ut [![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2FHsiangNianian%2FDropOut.svg?type=small)](https://app.fossa.com/projects/git%2Bgithub.com%2FHsiangNianian%2FDropOut?ref=badge_small) [![pre-commit.ci status](https://results.pre-commit.ci/badge/github/HsiangNianian/DropOut/main.svg)](https://results.pre-commit.ci/latest/github/HsiangNianian/DropOut/main) -- cgit v1.2.3-70-g09d2 From 1e0905613a7b7b98daf6dfecffa87fc0096a8e55 Mon Sep 17 00:00:00 2001 From: HsiangNianian Date: Fri, 16 Jan 2026 14:49:05 +0800 Subject: feat: add UNC prefix stripping for Windows paths in Java handling Implemented a helper function to strip the UNC prefix from file paths on Windows, ensuring cleaner path handling. Updated the Java candidate retrieval process to resolve symlinks and apply the new prefix stripping function, enhancing compatibility and usability on Windows systems. --- src-tauri/src/core/java.rs | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src-tauri/src/core/java.rs b/src-tauri/src/core/java.rs index 7aa43b8..3f7a1e4 100644 --- a/src-tauri/src/core/java.rs +++ b/src-tauri/src/core/java.rs @@ -13,6 +13,18 @@ use crate::utils::zip; const ADOPTIUM_API_BASE: &str = "https://api.adoptium.net/v3"; const CACHE_DURATION_SECS: u64 = 24 * 60 * 60; // 24 hours +/// Helper to strip UNC prefix on Windows (\\?\) +fn strip_unc_prefix(path: PathBuf) -> PathBuf { + #[cfg(target_os = "windows")] + { + let s = path.to_string_lossy().to_string(); + if s.starts_with(r"\\?\") { + return PathBuf::from(&s[4..]); + } + } + path +} + #[derive(Debug, Clone, Serialize, Deserialize)] pub struct JavaInstallation { pub path: String, @@ -649,7 +661,11 @@ fn get_java_candidates() -> Vec { for line in paths.lines() { let path = PathBuf::from(line.trim()); if path.exists() { - candidates.push(path); + // Resolve symlinks (important for Windows javapath wrapper) + let resolved = std::fs::canonicalize(&path).unwrap_or(path); + // Strip UNC prefix if present to keep paths clean + let final_path = strip_unc_prefix(resolved); + candidates.push(final_path); } } } -- cgit v1.2.3-70-g09d2 From 4d6ed7b93ed57a2f397e4f8060b2b183b7c86774 Mon Sep 17 00:00:00 2001 From: HsiangNianian Date: Fri, 16 Jan 2026 14:49:50 +0800 Subject: feat: enhance Java path handling by resolving symlinks and stripping UNC prefixes Updated the Java installation and executable retrieval functions to resolve symlinks and strip UNC prefixes from paths. This improvement ensures cleaner and more reliable path handling on Windows systems, enhancing compatibility and usability. --- src-tauri/src/core/java.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src-tauri/src/core/java.rs b/src-tauri/src/core/java.rs index 3f7a1e4..1d57d21 100644 --- a/src-tauri/src/core/java.rs +++ b/src-tauri/src/core/java.rs @@ -577,6 +577,10 @@ pub async fn download_and_install_java( )); } + // Resolve symlinks and strip UNC prefix to ensure clean path + let java_bin = std::fs::canonicalize(&java_bin).map_err(|e| e.to_string())?; + let java_bin = strip_unc_prefix(java_bin); + // 9. Verify installation let installation = check_java_installation(&java_bin) .ok_or_else(|| "Failed to verify Java installation".to_string())?; @@ -919,7 +923,8 @@ fn find_java_executable(dir: &PathBuf) -> Option { // Directly look in the bin directory let direct_bin = dir.join("bin").join(bin_name); if direct_bin.exists() { - return Some(direct_bin); + let resolved = std::fs::canonicalize(&direct_bin).unwrap_or(direct_bin); + return Some(strip_unc_prefix(resolved)); } // macOS: Contents/Home/bin/java @@ -939,7 +944,8 @@ fn find_java_executable(dir: &PathBuf) -> Option { // Try direct bin path let nested_bin = path.join("bin").join(bin_name); if nested_bin.exists() { - return Some(nested_bin); + let resolved = std::fs::canonicalize(&nested_bin).unwrap_or(nested_bin); + return Some(strip_unc_prefix(resolved)); } // macOS: nested/Contents/Home/bin/java -- cgit v1.2.3-70-g09d2 From c3a0bef0767aec88fdd619199bed4bad6b57057c Mon Sep 17 00:00:00 2001 From: HsiangNianian Date: Fri, 16 Jan 2026 14:55:17 +0800 Subject: feat: enhance CI workflow by adding Node.js, pnpm, and Tauri CLI installation Updated the GitHub Actions workflow to include steps for installing Node.js and pnpm, as well as the Tauri CLI. Added commands to install frontend dependencies and build the application for different operating systems, ensuring a more robust and comprehensive CI process. --- .github/workflows/test.yml | 58 +++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 55 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 5440cd8..ebf0b91 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -65,6 +65,23 @@ jobs: - name: Install Rust uses: dtolnay/rust-toolchain@stable + - name: Install Node.js + uses: actions/setup-node@v4 + with: + node-version: 20 + + - name: Install pnpm + uses: pnpm/action-setup@v2 + with: + version: 8 + + - name: Install Frontend Dependencies + working-directory: ./ui + run: pnpm install + + - name: Install Tauri CLI + run: cargo install tauri-cli + - name: Rust Cache uses: swatinem/rust-cache@v2 with: @@ -74,6 +91,41 @@ jobs: working-directory: ./src-tauri run: cargo test --verbose - - name: Build (Dev) - working-directory: ./src-tauri - run: cargo build --verbose + - name: Build App (Debug) + run: cargo tauri build --debug + + - name: Get Short SHA + id: slug + run: echo "sha8=$(echo ${GITHUB_SHA} | cut -c1-8)" >> $GITHUB_OUTPUT + + - name: Upload Artifact (Linux) + if: runner.os == 'Linux' + uses: actions/upload-artifact@v4 + with: + name: dropout-linux-${{ matrix.wayland && 'arch' || 'ubuntu' }}-${{ steps.slug.outputs.sha8 }} + path: | + src-tauri/target/debug/bundle/appimage/*.AppImage + src-tauri/target/debug/bundle/deb/*.deb + src-tauri/target/debug/dropout + retention-days: 5 + + - name: Upload Artifact (Windows) + if: runner.os == 'Windows' + uses: actions/upload-artifact@v4 + with: + name: dropout-windows-${{ steps.slug.outputs.sha8 }} + path: | + src-tauri/target/debug/bundle/msi/*.msi + src-tauri/target/debug/bundle/nsis/*.exe + src-tauri/target/debug/dropout.exe + retention-days: 5 + + - name: Upload Artifact (macOS) + if: runner.os == 'macOS' + uses: actions/upload-artifact@v4 + with: + name: dropout-macos-${{ steps.slug.outputs.sha8 }} + path: | + src-tauri/target/debug/bundle/dmg/*.dmg + src-tauri/target/debug/bundle/macos/DropOut.app + retention-days: 5 -- cgit v1.2.3-70-g09d2 From 066ffc6ecf27a531dbab76195230dae671ed3a0f Mon Sep 17 00:00:00 2001 From: HsiangNianian Date: Fri, 16 Jan 2026 14:55:44 +0800 Subject: chore: update Node.js and pnpm versions in CI workflow Modified the GitHub Actions workflow to upgrade Node.js from version 20 to 22 and pnpm from version 8 to 9, ensuring compatibility with the latest features and improvements. --- .github/workflows/test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ebf0b91..1f7f055 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -68,12 +68,12 @@ jobs: - name: Install Node.js uses: actions/setup-node@v4 with: - node-version: 20 + node-version: 22 - name: Install pnpm uses: pnpm/action-setup@v2 with: - version: 8 + version: 9 - name: Install Frontend Dependencies working-directory: ./ui -- cgit v1.2.3-70-g09d2 From 252618d3a5ab102498b7ee6d84e0c4afd3a0193c Mon Sep 17 00:00:00 2001 From: HsiangNianian Date: Fri, 16 Jan 2026 15:00:22 +0800 Subject: chore: update CI workflow to improve dependency installation Modified the GitHub Actions workflow to ensure the 'apt-get update' command does not fail and added 'libfuse2' to the list of installed dependencies for Ubuntu, enhancing the reliability of the CI process. --- .github/workflows/test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 1f7f055..2d0453f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -45,8 +45,8 @@ jobs: - name: Install Dependencies (Ubuntu) if: runner.os == 'Linux' && !matrix.wayland run: | - sudo apt-get update - sudo apt-get install -y libwebkit2gtk-4.1-dev build-essential curl wget file libssl-dev libgtk-3-dev libayatana-appindicator3-dev librsvg2-dev + sudo apt-get update || true + sudo apt-get install -y libwebkit2gtk-4.1-dev build-essential curl wget file libssl-dev libgtk-3-dev libayatana-appindicator3-dev librsvg2-dev libfuse2 - name: Install Dependencies (Arch Linux) if: matrix.wayland -- cgit v1.2.3-70-g09d2 From ddf10db485ea125df92d87955f110f46c0c1e7a0 Mon Sep 17 00:00:00 2001 From: HsiangNianian Date: Fri, 16 Jan 2026 15:03:19 +0800 Subject: chore: refine CI workflow to conditionally execute steps based on event type Updated the GitHub Actions workflow to conditionally run installation and build steps only when triggered by a 'workflow_dispatch' event. This change optimizes the workflow by separating build processes for push/PR events and manual triggers, enhancing clarity and efficiency in CI operations. --- .github/workflows/test.yml | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 2d0453f..8bf6d2f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -66,20 +66,24 @@ jobs: uses: dtolnay/rust-toolchain@stable - name: Install Node.js + if: github.event_name == 'workflow_dispatch' uses: actions/setup-node@v4 with: node-version: 22 - name: Install pnpm + if: github.event_name == 'workflow_dispatch' uses: pnpm/action-setup@v2 with: version: 9 - name: Install Frontend Dependencies + if: github.event_name == 'workflow_dispatch' working-directory: ./ui run: pnpm install - name: Install Tauri CLI + if: github.event_name == 'workflow_dispatch' run: cargo install tauri-cli - name: Rust Cache @@ -91,15 +95,22 @@ jobs: working-directory: ./src-tauri run: cargo test --verbose + - name: Build Rust Only (Push/PR) + if: github.event_name != 'workflow_dispatch' + working-directory: ./src-tauri + run: cargo build --verbose + - name: Build App (Debug) + if: github.event_name == 'workflow_dispatch' run: cargo tauri build --debug - name: Get Short SHA + if: github.event_name == 'workflow_dispatch' id: slug run: echo "sha8=$(echo ${GITHUB_SHA} | cut -c1-8)" >> $GITHUB_OUTPUT - name: Upload Artifact (Linux) - if: runner.os == 'Linux' + if: runner.os == 'Linux' && github.event_name == 'workflow_dispatch' uses: actions/upload-artifact@v4 with: name: dropout-linux-${{ matrix.wayland && 'arch' || 'ubuntu' }}-${{ steps.slug.outputs.sha8 }} @@ -110,7 +121,7 @@ jobs: retention-days: 5 - name: Upload Artifact (Windows) - if: runner.os == 'Windows' + if: runner.os == 'Windows' && github.event_name == 'workflow_dispatch' uses: actions/upload-artifact@v4 with: name: dropout-windows-${{ steps.slug.outputs.sha8 }} @@ -121,7 +132,7 @@ jobs: retention-days: 5 - name: Upload Artifact (macOS) - if: runner.os == 'macOS' + if: runner.os == 'macOS' && github.event_name == 'workflow_dispatch' uses: actions/upload-artifact@v4 with: name: dropout-macos-${{ steps.slug.outputs.sha8 }} -- cgit v1.2.3-70-g09d2