From 8fb79242bf74edc8e153cae0dff533b434298685 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20M=C3=BCller?= Date: Sat, 24 Sep 2022 13:20:03 +0200 Subject: [PATCH] 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). --- src/base/system.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/base/system.cpp b/src/base/system.cpp index 9761ae3b1..6041239c4 100644 --- a/src/base/system.cpp +++ b/src/base/system.cpp @@ -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