From 80f6102629b746ea520d3ec54aaa6414c669a998 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 3 Jul 2010 17:47:06 +0000 Subject: 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. --- source/blender/windowmanager/intern/wm_files.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'source/blender/windowmanager') 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 #include +#include #ifdef WIN32 #include /* 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"); } } -- cgit v1.2.3