Esme Povirk (@madewokherd) commented about dlls/sane.ds/cfg.c:
- }
- *last_slash = L'\0';
- attr = GetFileAttributesW(path);
- if (attr == INVALID_FILE_ATTRIBUTES)
- {
if (!CreateDirectoryW(path, NULL))
{
DWORD err = GetLastError();
ERR("CreateDirectoryW returned error: %lu\n", err);
return FALSE;
}
- }
- return TRUE;
+}
+BOOL is_exist_file(WCHAR* path)
I would suggest simply trying to create the file you will use when it's time to use it and handling any errors that come up. Checking first can cause race conditions: https://en.wikipedia.org/wiki/Time-of-check_to_time-of-use