Cleanup: avoid calling stat twice in BLI_dir_create_recursive
This commit is contained in:
@@ -1296,11 +1296,12 @@ bool BLI_dir_create_recursive(const char *dirname)
|
||||
char *tmp;
|
||||
bool ret = true;
|
||||
|
||||
if (BLI_is_dir(dirname)) {
|
||||
return true;
|
||||
}
|
||||
if (BLI_exists(dirname)) {
|
||||
return false;
|
||||
const int mode = BLI_exists(dirname);
|
||||
if (mode != 0) {
|
||||
/* The file exists, either it's a directory (ok), or not,
|
||||
* in which case this function can't do anything useful
|
||||
* (the caller could remove it and re-run this function). */
|
||||
return S_ISDIR(mode) ? true : false;
|
||||
}
|
||||
|
||||
# ifdef MAXPATHLEN
|
||||
|
||||
Reference in New Issue
Block a user