fix
Some checks failed
BlockStorage/repertory/pipeline/head There was a failure building this commit
Some checks failed
BlockStorage/repertory/pipeline/head There was a failure building this commit
This commit is contained in:
parent
36e952606b
commit
854caffea8
@ -30,9 +30,9 @@
|
|||||||
namespace {
|
namespace {
|
||||||
[[nodiscard]] auto resolve(std::string path) -> std::string {
|
[[nodiscard]] auto resolve(std::string path) -> std::string {
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
if (repertory::utils::string::contains(path, "~") ||
|
if (repertory::utils::string::contains(path, "~\\") ||
|
||||||
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);
|
auto size = ::ExpandEnvironmentStringsA(path.c_str(), nullptr, 0);
|
||||||
|
|
||||||
@ -43,7 +43,7 @@ namespace {
|
|||||||
path = dest.c_str();
|
path = dest.c_str();
|
||||||
}
|
}
|
||||||
#else // !defined (_WIN32)
|
#else // !defined (_WIN32)
|
||||||
if (repertory::utils::string::contains(path, "~")) {
|
if (repertory::utils::string::contains(path, "~/")) {
|
||||||
std::string home{};
|
std::string home{};
|
||||||
auto res =
|
auto res =
|
||||||
repertory::utils::use_getpwuid(getuid(), [&home](struct passwd *pw) {
|
repertory::utils::use_getpwuid(getuid(), [&home](struct passwd *pw) {
|
||||||
@ -57,7 +57,7 @@ namespace {
|
|||||||
throw std::runtime_error("failed to getpwuid: " + res.reason);
|
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)
|
#endif // defined (_WIN32)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user