updated build system
This commit is contained in:
parent
cde0e92591
commit
29af6e5b7c
11
support/3rd_party/src/utils/path.cpp
vendored
11
support/3rd_party/src/utils/path.cpp
vendored
@ -36,6 +36,16 @@ static const std::wstring directory_seperator_str_w{
|
||||
};
|
||||
|
||||
[[nodiscard]] auto resolve(std::string path) -> std::string {
|
||||
#if defined(_WIN32)
|
||||
repertory::utils::string::replace(path, "~", "%USERPROFILE%");
|
||||
|
||||
std::string dest;
|
||||
dest.resize(::ExpandEnvironmentStringsA(path.c_str(), nullptr, 0));
|
||||
::ExpandEnvironmentStringsA(path.c_str(), dest.data(),
|
||||
static_cast<DWORD>(dest.size()));
|
||||
path = dest.c_str();
|
||||
return path;
|
||||
#else // !defined (_WIN32)
|
||||
std::string home{};
|
||||
repertory::utils::use_getpwuid(getuid(), [&home](struct passwd *pw) {
|
||||
home = (pw->pw_dir ? pw->pw_dir : "");
|
||||
@ -45,6 +55,7 @@ static const std::wstring directory_seperator_str_w{
|
||||
});
|
||||
|
||||
return repertory::utils::string::replace(path, "~", home);
|
||||
#endif // defined (_WIN32)
|
||||
}
|
||||
} // namespace
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user