FileSystem: Get rid of trailing nulls in GetWorkingDirectory()

This commit is contained in:
Connor McLaughlin 2021-12-17 20:44:08 +10:00
parent fa9e50d7c1
commit 592a591b5f
1 changed files with 7 additions and 1 deletions

View File

@ -2480,11 +2480,17 @@ std::string GetWorkingDirectory()
while (!getcwd(buffer.data(), buffer.size()))
{
if (errno != ERANGE)
return {};
{
buffer.clear();
break;
}
buffer.resize(buffer.size() * 2);
}
if (!buffer.empty())
buffer.resize(std::strlen(buffer.c_str()));
return buffer;
}