Merge pull request #210 from Pagecran/fix/tauri-windows-startup

fix(tauri): restore Windows desktop startup
This commit is contained in:
Shantur Rathore
2026-03-08 17:26:20 +00:00
committed by GitHub
3 changed files with 37 additions and 5 deletions

19
package-lock.json generated
View File

@@ -3305,6 +3305,22 @@
"node": ">= 10" "node": ">= 10"
} }
}, },
"node_modules/@tauri-apps/cli-win32-x64-msvc": {
"version": "2.9.4",
"resolved": "https://registry.npmjs.org/@tauri-apps/cli-win32-x64-msvc/-/cli-win32-x64-msvc-2.9.4.tgz",
"integrity": "sha512-EdYd4c9wGvtPB95kqtEyY+bUR+k4kRw3IA30mAQ1jPH6z57AftT8q84qwv0RDp6kkEqOBKxeInKfqi4BESYuqg==",
"cpu": [
"x64"
],
"dev": true,
"license": "Apache-2.0 OR MIT",
"os": [
"win32"
],
"engines": {
"node": ">= 10"
}
},
"node_modules/@tauri-apps/plugin-notification": { "node_modules/@tauri-apps/plugin-notification": {
"version": "2.3.3", "version": "2.3.3",
"resolved": "https://registry.npmjs.org/@tauri-apps/plugin-notification/-/plugin-notification-2.3.3.tgz", "resolved": "https://registry.npmjs.org/@tauri-apps/plugin-notification/-/plugin-notification-2.3.3.tgz",
@@ -12066,7 +12082,8 @@
"version": "0.12.2", "version": "0.12.2",
"license": "MIT", "license": "MIT",
"devDependencies": { "devDependencies": {
"@tauri-apps/cli": "^2.9.4" "@tauri-apps/cli": "^2.9.4",
"@tauri-apps/cli-win32-x64-msvc": "^2.9.4"
} }
}, },
"packages/ui": { "packages/ui": {

View File

@@ -13,6 +13,7 @@
"build": "tauri build" "build": "tauri build"
}, },
"devDependencies": { "devDependencies": {
"@tauri-apps/cli": "^2.9.4" "@tauri-apps/cli": "^2.9.4",
"@tauri-apps/cli-win32-x64-msvc": "^2.9.4"
} }
} }

View File

@@ -900,6 +900,11 @@ fn resolve_dist_entry(_app: &AppHandle) -> Option<String> {
if let Ok(exe) = std::env::current_exe() { if let Ok(exe) = std::env::current_exe() {
if let Some(dir) = exe.parent() { if let Some(dir) = exe.parent() {
candidates.push(Some(dir.join("resources/server/dist/bin.js")));
candidates.push(Some(dir.join("resources/server/dist/index.js")));
candidates.push(Some(dir.join("resources/server/dist/server/bin.js")));
candidates.push(Some(dir.join("resources/server/dist/server/index.js")));
let resources = dir.join("../Resources"); let resources = dir.join("../Resources");
candidates.push(Some(resources.join("server/dist/bin.js"))); candidates.push(Some(resources.join("server/dist/bin.js")));
candidates.push(Some(resources.join("server/dist/index.js"))); candidates.push(Some(resources.join("server/dist/index.js")));
@@ -995,9 +1000,18 @@ fn first_existing(paths: Vec<Option<PathBuf>>) -> Option<String> {
} }
fn normalize_path(path: PathBuf) -> String { fn normalize_path(path: PathBuf) -> String {
if let Ok(clean) = path.canonicalize() { let resolved = if let Ok(clean) = path.canonicalize() {
clean.to_string_lossy().to_string() clean
} else { } else {
path.to_string_lossy().to_string() path
};
let rendered = resolved.to_string_lossy().to_string();
if let Some(stripped) = rendered.strip_prefix("\\\\?\\UNC\\") {
format!("\\\\{}", stripped)
} else if let Some(stripped) = rendered.strip_prefix("\\\\?\\") {
stripped.to_string()
} else {
rendered
} }
} }