Skip to content

Commit

Permalink
Try windows path fix
Browse files Browse the repository at this point in the history
  • Loading branch information
coderofstuff committed Dec 10, 2023
1 parent f8fea02 commit 522a477
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions kaspad/src/daemon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,11 +120,14 @@ pub struct Runtime {
/// This function can be used to identify the location of
/// the application folder that contains kaspad logs and the database.
pub fn get_app_dir_from_args(args: &Args) -> PathBuf {
let app_dir = args
.appdir
.clone()
.unwrap_or_else(|| get_app_dir().as_path().to_str().unwrap().to_string())
.replace('~', get_home_dir().as_path().to_str().unwrap());
let mut app_dir = args.appdir.clone().unwrap_or_else(|| get_app_dir().as_path().to_str().unwrap().to_string());

// TODO: temporary patch. Why do we do this replace for every OS in the first place?
#[cfg(any(target_os = "macos", target_os = "linux"))]
{
app_dir = app_dir.replace('~', get_home_dir().as_path().to_str().unwrap());
}

if app_dir.is_empty() {
get_app_dir()
} else {
Expand Down

0 comments on commit 522a477

Please sign in to comment.