-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
46 additions
and
31 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
use std::env; | ||
use std::fs; | ||
use std::path::PathBuf; | ||
|
||
pub fn get_dist_path() -> Option<PathBuf> { | ||
let exe_path = match env::current_exe() { | ||
Ok(path) => path, | ||
Err(e) => { | ||
eprintln!("Error getting current exe path: {:?}", e); | ||
return None; | ||
} | ||
}; | ||
|
||
if let Ok(real_path) = fs::read_link(&exe_path) { | ||
let project_root = real_path.parent()?.parent()?.to_path_buf(); | ||
let dist_path = project_root.join("dist"); | ||
if dist_path.exists() { | ||
return Some(dist_path); | ||
} | ||
} | ||
|
||
let project_root = exe_path.parent()?.parent()?.to_path_buf(); | ||
let dist_path = project_root.join("dist"); | ||
if dist_path.exists() { | ||
return Some(dist_path); | ||
} | ||
|
||
None | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters