mirror of
https://github.com/shadps4-emu/ext-SDL.git
synced 2025-02-21 11:11:12 +00:00
filesystem: Windows SDL_SYS_CreateDirectory should succeed if dir exists.
This commit is contained in:
parent
48c3ee2120
commit
94030131de
@ -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");
|
||||
|
Loading…
x
Reference in New Issue
Block a user