winport: fix #442

This commit is contained in:
zeromus 2021-04-09 11:43:20 -04:00
parent 9d8332d671
commit e8f619c44a
1 changed files with 6 additions and 1 deletions

View File

@ -155,11 +155,16 @@ BOOL DirectoryExists(LPCTSTR szPath)
void createDirectoryRecursively(std::wstring path)
{
signed int pos = 0;
std::vector<std::wstring> parts;
do
{
pos = path.find_first_of(L"\\/", pos + 1);
CreateDirectoryW(path.substr(0, pos).c_str(), NULL);
parts.push_back(path.substr(0, pos));
} while (pos != std::wstring::npos);
if(parts.size()==0) return;
parts.pop_back();
for(auto &str : parts)
CreateDirectoryW(str.c_str(), NULL);
}