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;
|
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);
|
SDL_free(wpath);
|
||||||
if (!rc) {
|
if (!rc) {
|
||||||
return WIN_SetError("Couldn't create directory");
|
return WIN_SetError("Couldn't create directory");
|
||||||
|
|||||||
Reference in New Issue
Block a user