From cd870ab6d13b4d51856e28b019aab0785197226c Mon Sep 17 00:00:00 2001 From: coderofstuff <114628839+coderofstuff@users.noreply.github.com> Date: Sat, 9 Dec 2023 10:40:36 -0700 Subject: [PATCH] Try windows path fix --- kaspad/src/daemon.rs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/kaspad/src/daemon.rs b/kaspad/src/daemon.rs index 0950ad8fa..8d3906bfc 100644 --- a/kaspad/src/daemon.rs +++ b/kaspad/src/daemon.rs @@ -132,11 +132,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 {