Skip to content

Commit f29f496

Browse files
More reliable setting of resource dir
1 parent 3d73356 commit f29f496

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

src-tauri/src/state.rs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,12 @@ impl AppStatics {
4141
let path_resolver = app.handle().path();
4242
let app_data_dir = path_resolver.app_data_dir().unwrap();
4343

44-
let resource_dir = if cfg!(target_os = "linux") {
45-
// HACK: tauri's path resolver doesn't work correctly on linux standalone builds.
46-
// it reports /usr/lib/OpenFusionLauncher for the resource directory,
47-
// but the resources are actually in the same directory as the executable.
48-
std::env::current_exe().unwrap().parent().unwrap().into()
49-
} else {
50-
path_resolver.resource_dir().unwrap()
51-
};
44+
let mut resource_dir = path_resolver.resource_dir().unwrap();
45+
if !std::fs::exists(resource_dir.join("ffrunner.exe")).unwrap_or(false) {
46+
// Resource directory is incorrect. Assume standalone build
47+
// and use the current executable's directory as the resource dir.
48+
resource_dir = std::env::current_exe().unwrap().parent().unwrap().into();
49+
}
5250

5351
let ff_cache_dir = path_resolver
5452
.resolve("ffcache", BaseDirectory::AppCache)

0 commit comments

Comments
 (0)