updated build system

This commit is contained in:
Scott E. Graves 2024-08-02 23:07:48 -05:00
parent 29af6e5b7c
commit 30806c6ebd

View File

@ -37,6 +37,8 @@ static const std::wstring directory_seperator_str_w{
[[nodiscard]] auto resolve(std::string path) -> std::string {
#if defined(_WIN32)
if (repertory::utils::string::contains(path, "~") ||
repertory::utils::string::contains(path, "%")) {
repertory::utils::string::replace(path, "~", "%USERPROFILE%");
std::string dest;
@ -44,8 +46,9 @@ static const std::wstring directory_seperator_str_w{
::ExpandEnvironmentStringsA(path.c_str(), dest.data(),
static_cast<DWORD>(dest.size()));
path = dest.c_str();
return path;
}
#else // !defined (_WIN32)
if (repertory::utils::string::contains(path, "~")) {
std::string home{};
repertory::utils::use_getpwuid(getuid(), [&home](struct passwd *pw) {
home = (pw->pw_dir ? pw->pw_dir : "");
@ -55,7 +58,10 @@ static const std::wstring directory_seperator_str_w{
});
return repertory::utils::string::replace(path, "~", home);
}
#endif // defined (_WIN32)
return path;
}
} // namespace