BLI_delete: assert that dir is true when recursive is true
While this isn't an error avoid ambiguity for recursive deletion as it's not meaningful to delete a file.
This commit is contained in:
parent
4e3771124d
commit
fbe16bc1eb
|
@ -734,6 +734,9 @@ int BLI_delete(const char *path, bool dir, bool recursive)
|
|||
|
||||
BLI_assert(!BLI_path_is_rel(path));
|
||||
|
||||
/* Not an error but avoid ambiguous arguments (recursive file deletion isn't meaningful). */
|
||||
BLI_assert(!(dir == false && recursive == true));
|
||||
|
||||
if (recursive) {
|
||||
err = delete_recursive(path);
|
||||
}
|
||||
|
@ -1281,6 +1284,8 @@ int BLI_access(const char *filepath, int mode)
|
|||
int BLI_delete(const char *path, bool dir, bool recursive)
|
||||
{
|
||||
BLI_assert(!BLI_path_is_rel(path));
|
||||
/* Not an error but avoid ambiguous arguments (recursive file deletion isn't meaningful). */
|
||||
BLI_assert(!(dir == false && recursive == true));
|
||||
|
||||
if (recursive) {
|
||||
return recursive_operation(path, nullptr, nullptr, delete_single_file, delete_callback_post);
|
||||
|
|
|
@ -361,7 +361,7 @@ static void seq_disk_cache_handle_versioning(SeqDiskCache *disk_cache)
|
|||
}
|
||||
|
||||
if (version != DCACHE_CURRENT_VERSION) {
|
||||
BLI_delete(dirpath, false, true);
|
||||
BLI_delete(dirpath, true, true);
|
||||
seq_disk_cache_create_version_file(path_version_file);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue