comment unused BLI_move() function, also fixed error where it would delete the file even if renaming failed.

- found when testing recursive_operation().
This commit is contained in:
Campbell Barton 2013-03-09 09:52:38 +00:00
parent edf4855a38
commit 35b9fcb871

@ -283,6 +283,7 @@ int BLI_delete(const char *file, bool dir, bool recursive)
} }
/* Not used anywhere! */ /* Not used anywhere! */
#if 0
int BLI_move(const char *file, const char *to) int BLI_move(const char *file, const char *to)
{ {
int err; int err;
@ -312,7 +313,7 @@ int BLI_move(const char *file, const char *to)
return err; return err;
} }
#endif
int BLI_copy(const char *file, const char *to) int BLI_copy(const char *file, const char *to)
{ {
@ -786,6 +787,8 @@ static int copy_single_file(const char *from, const char *to)
return RecursiveOp_Callback_OK; return RecursiveOp_Callback_OK;
} }
/* Not used anywhere! */
#if 0
static int move_callback_pre(const char *from, const char *to) static int move_callback_pre(const char *from, const char *to)
{ {
int ret = rename(from, to); int ret = rename(from, to);
@ -808,17 +811,17 @@ static int move_single_file(const char *from, const char *to)
/* if *file represents a directory, moves all its contents into *to, else renames /* if *file represents a directory, moves all its contents into *to, else renames
* file itself to *to. */ * file itself to *to. */
/* Not used anywhere! */
int BLI_move(const char *file, const char *to) int BLI_move(const char *file, const char *to)
{ {
int ret = recursive_operation(file, to, move_callback_pre, move_single_file, NULL); int ret = recursive_operation(file, to, move_callback_pre, move_single_file, NULL);
if (ret) { if (ret && ret != -1) {
return recursive_operation(file, NULL, NULL, delete_single_file, delete_callback_post); return recursive_operation(file, NULL, NULL, delete_single_file, delete_callback_post);
} }
return ret; return ret;
} }
#endif
static char *check_destination(const char *file, const char *to) static char *check_destination(const char *file, const char *to)
{ {