Skip to content

Commit 548b830

Browse files
authored
Merge pull request #32 from Yashh56/fix/LinuxBuild
fix: Refactor process spawning logic for improved cross-platform compatibility
2 parents 5d22cb0 + 20cc4e0 commit 548b830

File tree

4 files changed

+13
-13
lines changed

4 files changed

+13
-13
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ node_modules
1111
dist
1212
dist-ssr
1313
*.local
14-
src-tauri/resources/*.exe
14+
src-tauri/resources/
1515

1616

1717
# Editor directories and files

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "relwave",
33
"private": true,
4-
"version": "0.1.0-beta.1",
4+
"version": "0.1.0-beta.2",
55
"type": "module",
66
"scripts": {
77
"dev": "vite",

src-tauri/src/bridge/process.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -72,13 +72,12 @@ fn spawn_bridge_process(app_handle: &AppHandle) -> Result<Child, String> {
7272
}
7373
}
7474

75-
// 3) Try exe directory (where the .exe is located)
75+
// 3) Try exe directory (where the executable is located - works for deb/appimage on Linux)
7676
if let Some(exe_dir) = get_exe_dir() {
77-
if let Some(child) = try_exe_dir_scripts(&exe_dir) {
77+
if let Some(child) = try_exe_dir_binary(&exe_dir) {
7878
return Ok(child);
7979
}
80-
#[cfg(target_os = "windows")]
81-
if let Some(child) = try_exe_dir_binary(&exe_dir) {
80+
if let Some(child) = try_exe_dir_scripts(&exe_dir) {
8281
return Ok(child);
8382
}
8483
}
@@ -180,14 +179,15 @@ fn try_exe_dir_scripts(exe_dir: &Path) -> Option<Child> {
180179
None
181180
}
182181

183-
#[cfg(target_os = "windows")]
182+
/// Try to find and spawn bridge binary in the exe directory (for Linux deb/appimage and Windows)
184183
fn try_exe_dir_binary(exe_dir: &Path) -> Option<Child> {
185-
let paths = [
186-
exe_dir.join("bridge.exe"),
187-
exe_dir.join("_up_").join("bridge.exe"),
188-
];
184+
#[cfg(target_os = "windows")]
185+
let binary_names = ["bridge.exe", "_up_/bridge.exe"];
186+
#[cfg(not(target_os = "windows"))]
187+
let binary_names = ["bridge", "_up_/bridge"];
189188

190-
for exe_path in &paths {
189+
for name in binary_names {
190+
let exe_path = exe_dir.join(name);
191191
if exe_path.exists() {
192192
if let Some(exe_str) = exe_path.to_str() {
193193
if let Ok(c) = try_spawn(exe_str, &[]) {

src-tauri/tauri.conf.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"$schema": "https://schema.tauri.app/config/2",
33
"productName": "RelWave",
4-
"version": "0.1.0-beta.1",
4+
"version": "0.1.0-beta.2",
55
"identifier": "com.yashs.RelWave",
66
"build": {
77
"beforeDevCommand": "npm run dev",

0 commit comments

Comments
 (0)