From 854caffea83ebf45d1038cc80d32e6b35aef4121 Mon Sep 17 00:00:00 2001 From: "Scott E. Graves" Date: Wed, 9 Oct 2024 16:58:27 -0500 Subject: [PATCH] fix --- support/src/utils/path.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/support/src/utils/path.cpp b/support/src/utils/path.cpp index 84037685..20453851 100644 --- a/support/src/utils/path.cpp +++ b/support/src/utils/path.cpp @@ -30,9 +30,9 @@ namespace { [[nodiscard]] auto resolve(std::string path) -> std::string { #if defined(_WIN32) - if (repertory::utils::string::contains(path, "~") || + if (repertory::utils::string::contains(path, "~\\") || repertory::utils::string::contains(path, "%")) { - repertory::utils::string::replace(path, "~", "%USERPROFILE%"); + repertory::utils::string::replace(path, "~\\", "%USERPROFILE%\\"); auto size = ::ExpandEnvironmentStringsA(path.c_str(), nullptr, 0); @@ -43,7 +43,7 @@ namespace { path = dest.c_str(); } #else // !defined (_WIN32) - if (repertory::utils::string::contains(path, "~")) { + if (repertory::utils::string::contains(path, "~/")) { std::string home{}; auto res = repertory::utils::use_getpwuid(getuid(), [&home](struct passwd *pw) { @@ -57,7 +57,7 @@ namespace { throw std::runtime_error("failed to getpwuid: " + res.reason); } - return repertory::utils::string::replace(path, "~", home); + return repertory::utils::string::replace(path, "~/", home + "/"); } #endif // defined (_WIN32)