From 376e8b9b8db57181ea012243acc4794fc5a93fb5 Mon Sep 17 00:00:00 2001 From: Popax21 Date: Sun, 19 Nov 2023 02:57:41 +0100 Subject: [PATCH] Resolve application symlinks --- src/main.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index dcc0532..dd099b9 100644 --- a/src/main.rs +++ b/src/main.rs @@ -78,7 +78,12 @@ fn main() -> ExitCode { //Setup paths let install_dir = if !cfg!(feature="testapp") { - PathBuf::from(std::env::current_exe().unwrap().parent().unwrap()) + let mut exe_path = std::env::current_exe().unwrap(); + if std::fs::metadata(&exe_path).unwrap().is_symlink() { + exe_path = std::fs::read_link(&exe_path).unwrap(); + } + + PathBuf::from(exe_path.parent().unwrap()) } else { let mut path = PathBuf::from(env!("CARGO_MANIFEST_DIR")); path.push("test");