mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-19 06:28:19 +00:00
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:
parent
c61e5586ff
commit
8fb79242bf
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue