fixing home dir

This commit is contained in:
matlabbe
2026-05-31 12:23:43 -07:00
parent ce832878a0
commit 1d4d84272b
+8 -1
View File
@@ -5001,7 +5001,14 @@ void Rtabmap::setMemoryThreshold(int maxMemoryAllowed)
void Rtabmap::setWorkingDirectory(std::string path)
{
path = uReplaceChar(path, '~', UDirectory::homeDir());
// Expand leading "~" to the user's home directory (shell convention).
// We do NOT replace every "~" in the path -- Windows 8.3 short names
// embed "~" in the middle (e.g. C:\Users\RUNNER~1\...), and a blanket
// uReplaceChar would corrupt those.
if(!path.empty() && path[0] == '~')
{
path = UDirectory::homeDir() + path.substr(1);
}
if(!path.empty() && UDirectory::exists(path))
{
ULOGGER_DEBUG("Comparing new working directory path \"%s\" with \"%s\"", path.c_str(), _wDir.c_str());