[Bf-blender-cvs] [622019a] master: Fix BLI_rename returned success w/ missing source path
Campbell Barton
noreply at git.blender.org
Wed Feb 3 06:50:16 CET 2016
Commit: 622019a085c4a1e4290d588307cd8ab095c70231
Author: Campbell Barton
Date: Wed Feb 3 15:57:24 2016 +1100
Branches: master
https://developer.blender.org/rB622019a085c4a1e4290d588307cd8ab095c70231
Fix BLI_rename returned success w/ missing source path
===================================================================
M source/blender/blenlib/intern/fileops.c
===================================================================
diff --git a/source/blender/blenlib/intern/fileops.c b/source/blender/blenlib/intern/fileops.c
index 401bdd4..db4b3bc 100644
--- a/source/blender/blenlib/intern/fileops.c
+++ b/source/blender/blenlib/intern/fileops.c
@@ -720,6 +720,8 @@ int BLI_access(const char *filename, int mode)
/**
* Deletes the specified file or directory (depending on dir), optionally
* doing recursive delete of directory contents.
+ *
+ * \return zero on success (matching 'remove' behavior).
*/
int BLI_delete(const char *file, bool dir, bool recursive)
{
@@ -1043,9 +1045,14 @@ bool BLI_dir_create_recursive(const char *dirname)
return ret;
}
+/**
+ * \return zero on success (matching 'rename' behavior).
+ */
int BLI_rename(const char *from, const char *to)
{
- if (!BLI_exists(from)) return 0;
+ if (!BLI_exists(from)) {
+ return 1;
+ }
if (BLI_exists(to))
if (BLI_delete(to, false, false)) return 1;
More information about the Bf-blender-cvs
mailing list