aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorBegonia, HE <163421589+BegoniaHe@users.noreply.github.com>2026-01-16 08:05:51 +0100
committerGitHub <noreply@github.com>2026-01-16 08:05:51 +0100
commit46ea4d96c205276ecfb84928736ef02df8c104ff (patch)
treee759a5ea7b1c3cb2b0dc3823a166b758398bfc96
parent76ab8c504c3d094b3c9d3b2034a4c16384220926 (diff)
parentddf10db485ea125df92d87955f110f46c0c1e7a0 (diff)
downloadDropOut-46ea4d96c205276ecfb84928736ef02df8c104ff.tar.gz
DropOut-46ea4d96c205276ecfb84928736ef02df8c104ff.zip
Merge branch 'HsiangNianian:main' into fix/windows-java-path
-rw-r--r--.github/workflows/test.yml69
-rw-r--r--README.md2
-rw-r--r--src-tauri/Cargo.toml2
-rw-r--r--src-tauri/src/core/forge.rs15
-rw-r--r--src-tauri/src/core/java.rs47
-rw-r--r--src-tauri/tauri.conf.json2
6 files changed, 118 insertions, 19 deletions
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index 5440cd8..8bf6d2f 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
@@ -65,6 +65,27 @@ jobs:
- name: Install Rust
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
uses: swatinem/rust-cache@v2
with:
@@ -74,6 +95,48 @@ jobs:
working-directory: ./src-tauri
run: cargo test --verbose
- - name: Build (Dev)
+ - 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' && github.event_name == 'workflow_dispatch'
+ 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' && github.event_name == 'workflow_dispatch'
+ 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' && github.event_name == 'workflow_dispatch'
+ 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
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)
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/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 <path> 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..1d57d21 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;
@@ -11,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,
@@ -563,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())?;
@@ -636,16 +654,22 @@ fn get_java_candidates() -> Vec<PathBuf> {
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() {
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);
}
}
}
@@ -788,7 +812,12 @@ fn get_java_candidates() -> Vec<PathBuf> {
/// Check a specific Java installation and get its version info
fn check_java_installation(path: &PathBuf) -> Option<JavaInstallation> {
- 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);
@@ -894,7 +923,8 @@ fn find_java_executable(dir: &PathBuf) -> Option<PathBuf> {
// 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
@@ -914,7 +944,8 @@ fn find_java_executable(dir: &PathBuf) -> Option<PathBuf> {
// 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
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",