fix(system/file): fix bugged recursion in CreateDirectory implementation

This commit is contained in:
phaneron 2023-11-17 16:18:19 -05:00
parent 0ed54befe3
commit 05c63dbea7

View file

@ -387,7 +387,7 @@ bool CreateDirectory(FileParms* parms) {
if (recursive) { if (recursive) {
auto p = temp_path; auto p = temp_path;
if (isalpha(p[0]) && p[1] == ':') { if (isalpha(p[0]) && p[1] == ':') {
p += 2 p += 2;
} }
// Loop through path and call CreateDirectory on path elements // Loop through path and call CreateDirectory on path elements
@ -413,8 +413,8 @@ bool CreateDirectory(FileParms* parms) {
} }
} else { } else {
// Create only the supplied directory. // Create only the supplied directory.
if (::GetFileAttributes(temp) == INVALID_FILE_ATTRIBUTES) { if (::GetFileAttributes(temp_path) == INVALID_FILE_ATTRIBUTES) {
if (!::CreateDirectory(temp, nullptr)) { if (!::CreateDirectory(temp_path, nullptr)) {
if (::GetLastError() != ERROR_ALREADY_EXISTS) { if (::GetLastError() != ERROR_ALREADY_EXISTS) {
return false; return false;
} }