We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents d52db6b + 5cc607c commit 59381dbCopy full SHA for 59381db
components/files/windowspath.cpp
@@ -61,7 +61,14 @@ namespace Files
61
{
62
// This should always be true. Note that we don't need to care above because of the trailing \0
63
if (len % sizeof(wchar_t) == 0)
64
- return std::filesystem::path(buffer.data(), buffer.data() + len / sizeof(wchar_t));
+ {
65
+ std::wstring_view view(buffer.data(), len / sizeof(wchar_t));
66
+ // Strip trailing \0 because the path constructor won't do it for us
67
+ const auto pos = view.find(L'\0');
68
+ if (pos != std::wstring_view::npos)
69
+ view = view.substr(0, pos);
70
+ return std::filesystem::path(view);
71
+ }
72
}
73
74
return {};
0 commit comments