Use CreateDirectoryW + GetLastError instead of _wmkdir + errno

For more consistent usage of the Windows API. `_wmkdir` seems to be a wrapper around `CreateDirectoryW` anyway, at least in the [Wine API](https://source.winehq.org/ident?_i=_wmkdir).
This commit is contained in:
Robert Müller 2022-09-24 13:20:03 +02:00
parent c61e5586ff
commit 8fb79242bf

View file

@ -2278,9 +2278,9 @@ int fs_makedir(const char *path)
#if defined(CONF_FAMILY_WINDOWS)
WCHAR wBuffer[IO_MAX_PATH_LENGTH];
MultiByteToWideChar(CP_UTF8, 0, path, -1, wBuffer, std::size(wBuffer));
if(_wmkdir(wBuffer) == 0)
if(CreateDirectoryW(wBuffer, NULL) != 0)
return 0;
if(errno == EEXIST)
if(GetLastError() == ERROR_ALREADY_EXISTS)
return 0;
return -1;
#else