Mercurial > minori
diff src/core/filesystem.cpp @ 44:619cbd6e69f9
filesystem: fix CreateDirectories function
author | Paper <mrpapersonic@gmail.com> |
---|---|
date | Fri, 22 Sep 2023 13:52:11 -0400 |
parents | 2743011a6042 |
children | 4b05bc7668eb |
line wrap: on
line diff
--- a/src/core/filesystem.cpp Fri Sep 22 12:06:49 2023 -0400 +++ b/src/core/filesystem.cpp Fri Sep 22 13:52:11 2023 -0400 @@ -26,6 +26,7 @@ std::string temp = ""; size_t start; size_t end = 0; + temp.append(path.substr(0, path.find_first_not_of(DELIM, end))); while ((start = path.find_first_not_of(DELIM, end)) != std::string::npos) { end = path.find(DELIM, start); @@ -35,8 +36,9 @@ /* ERROR_PATH_NOT_FOUND should NOT happen here */ return false; #else - if (mkdir(temp.c_str(), 0755)) - return false; + struct stat st; + if (stat(temp.c_str(), &st) == -1) + mkdir(temp.c_str(), 0755); #endif temp.append(DELIM); }