-
Notifications
You must be signed in to change notification settings - Fork 0
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
1 parent
a4bfc31
commit 52d0b1d
Showing
3 changed files
with
25 additions
and
15 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,23 @@ | ||
use std::env; | ||
use std::path::{Path, PathBuf}; | ||
|
||
pub mod cmd; | ||
pub mod logs; | ||
pub mod rc4; | ||
pub mod service; | ||
|
||
/// app所在目录 | ||
pub fn app_dir() -> String { | ||
if cfg!(target_os = "windows") { | ||
// env::current_dir()?.to_str().unwrap_or(".").to_string() | ||
env::current_exe() | ||
.unwrap_or(PathBuf::new()) | ||
.parent() | ||
.unwrap_or(Path::new(".")) | ||
.to_str() | ||
.unwrap_or(".") | ||
.to_string() | ||
} else { | ||
".".to_string() | ||
} | ||
} |