diff options
author | Campbell Barton <ideasman42@gmail.com> | 2016-02-03 08:37:02 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2016-02-03 08:41:17 +0300 |
commit | 91bd58869c34d97e01823a3e04010e41724a7f68 (patch) | |
tree | c7cec1a12c6fa65de260f94beebd2317ae68a931 /source/blender/editors/space_file/file_draw.c | |
parent | 622019a085c4a1e4290d588307cd8ab095c70231 (diff) |
Include why file operations fail in reports
Diffstat (limited to 'source/blender/editors/space_file/file_draw.c')
-rw-r--r-- | source/blender/editors/space_file/file_draw.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/source/blender/editors/space_file/file_draw.c b/source/blender/editors/space_file/file_draw.c index 2d9ecbdf415..52d01063175 100644 --- a/source/blender/editors/space_file/file_draw.c +++ b/source/blender/editors/space_file/file_draw.c @@ -31,6 +31,7 @@ #include <math.h> #include <string.h> +#include <errno.h> #include "BLI_blenlib.h" #include "BLI_utildefines.h" @@ -426,7 +427,16 @@ static void renamebutton_cb(bContext *C, void *UNUSED(arg1), char *oldname) if (!STREQ(orgname, newname)) { if (!BLI_exists(newname)) { - BLI_rename(orgname, newname); + errno = 0; + if ((BLI_rename(orgname, newname) != 0) || + !BLI_exists(newname)) + { + WM_reportf(RPT_ERROR, + "Could not rename: %s", + errno ? strerror(errno) : "unknown error"); + WM_report_banner_show(); + } + /* to make sure we show what is on disk */ ED_fileselect_clear(wm, sa, sfile); } |