diff options
author | Campbell Barton <ideasman42@gmail.com> | 2010-07-03 21:47:06 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2010-07-03 21:47:06 +0400 |
commit | 80f6102629b746ea520d3ec54aaa6414c669a998 (patch) | |
tree | 8d254cc92120eca8be6ef5b92af7be3c3626f202 /source/blender/windowmanager | |
parent | 9a85435e96af9933b282594b6ad8b23ca598d8bc (diff) |
better reporting for file i/o failier, use system error message in more places: Permission Denied, No space left, File not found etc.
- blend load/save uses os message.
- image load gives os message. (remove check for slash at end of line, just let the os report an error)
- python api load image/font/text raise errors with message (was just retuning None for image and font)
- minor edits to py api errors.
Diffstat (limited to 'source/blender/windowmanager')
-rw-r--r-- | source/blender/windowmanager/intern/wm_files.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c index be6ef77526e..5298711ef52 100644 --- a/source/blender/windowmanager/intern/wm_files.c +++ b/source/blender/windowmanager/intern/wm_files.c @@ -30,6 +30,7 @@ */ #include <stdio.h> #include <string.h> +#include <errno.h> #ifdef WIN32 #include <windows.h> /* need to include windows.h so _WIN32_IE is defined */ @@ -261,6 +262,9 @@ void WM_read_file(bContext *C, char *name, ReportList *reports) { int retval; + /* so we can get the error message */ + errno = 0; + /* first try to append data from exotic file formats... */ /* it throws error box when file doesnt exist and returns -1 */ /* note; it should set some error message somewhere... (ton) */ @@ -317,7 +321,7 @@ void WM_read_file(bContext *C, char *name, ReportList *reports) BKE_write_undo(C, "Import file"); else if(retval == -1) { if(reports) - BKE_reportf(reports, RPT_ERROR, "Can't read file \"%s\".", name); + BKE_reportf(reports, RPT_ERROR, "Can't read file: \"%s\", %s.", name, errno ? strerror(errno) : "Incompatible file format"); } } |