mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-04-21 14:55:39 +00:00
filesystem: Windows SDL_SYS_CreateDirectory should succeed if dir exists.
This commit is contained in:
@@ -167,7 +167,16 @@ bool SDL_SYS_CreateDirectory(const char *path)
|
||||
return false;
|
||||
}
|
||||
|
||||
const DWORD rc = CreateDirectoryW(wpath, NULL);
|
||||
DWORD rc = CreateDirectoryW(wpath, NULL);
|
||||
if (!rc && (GetLastError() == ERROR_ALREADY_EXISTS)) {
|
||||
WIN32_FILE_ATTRIBUTE_DATA winstat;
|
||||
if (GetFileAttributesExW(wpath, GetFileExInfoStandard, &winstat)) {
|
||||
if (winstat.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
|
||||
rc = 1; // exists and is already a directory: cool.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SDL_free(wpath);
|
||||
if (!rc) {
|
||||
return WIN_SetError("Couldn't create directory");
|
||||
|
||||
Reference in New Issue
Block a user