Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/windowmanager/intern/wm_files.c')
-rw-r--r--source/blender/windowmanager/intern/wm_files.c27
1 files changed, 18 insertions, 9 deletions
diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c
index e7165598e38..22b10c8c618 100644
--- a/source/blender/windowmanager/intern/wm_files.c
+++ b/source/blender/windowmanager/intern/wm_files.c
@@ -276,7 +276,7 @@ void WM_read_file(bContext *C, const char *name, ReportList *reports)
retval= BKE_read_exotic(CTX_data_scene(C), name);
/* we didn't succeed, now try to read Blender file */
- if (retval== 0) {
+ if (retval == BKE_READ_EXOTIC_OK_BLEND) {
int G_f= G.f;
ListBase wmbase;
@@ -298,9 +298,9 @@ void WM_read_file(bContext *C, const char *name, ReportList *reports)
// XXX mainwindow_set_filename_to_title(G.main->name);
- if(retval==2) wm_init_userdef(C); // in case a userdef is read from regular .blend
+ if(retval == BKE_READ_FILE_OK_USERPREFS) wm_init_userdef(C); // in case a userdef is read from regular .blend
- if (retval!=0) {
+ if (retval != BKE_READ_FILE_FAIL) {
G.relbase_valid = 1;
if(!G.background) /* assume automated tasks with background, dont write recent file list */
write_history();
@@ -327,13 +327,22 @@ void WM_read_file(bContext *C, const char *name, ReportList *reports)
BKE_write_undo(C, "original"); /* save current state */
}
- else if(retval==1)
+ else if(retval == BKE_READ_EXOTIC_OK_OTHER)
BKE_write_undo(C, "Import file");
- else if(retval == -1) {
- if(reports)
- BKE_reportf(reports, RPT_ERROR, "Can't read file: \"%s\", %s.", name, errno ? strerror(errno) : "Incompatible file format");
+ else if(retval == BKE_READ_EXOTIC_FAIL_OPEN) {
+ BKE_reportf(reports, RPT_ERROR, "Can't read file: \"%s\", %s.", name, errno ? strerror(errno) : "Unable to open the file");
}
-
+ else if(retval == BKE_READ_EXOTIC_FAIL_FORMAT) {
+ BKE_reportf(reports, RPT_ERROR, "File format is not supported in file: \"%s\".", name);
+ }
+ else if(retval == BKE_READ_EXOTIC_FAIL_PATH) {
+ BKE_reportf(reports, RPT_ERROR, "File path invalid: \"%s\".", name);
+ }
+ else {
+ BKE_reportf(reports, RPT_ERROR, "Unknown error loading: \"%s\".", name);
+ BKE_assert(!"invalid 'retval'");
+ }
+
WM_cursor_wait(0);
}
@@ -372,7 +381,7 @@ int WM_read_homefile(bContext *C, wmOperator *op)
wm_window_match_init(C, &wmbase);
if (!from_memory && BLI_exists(tstr)) {
- success = BKE_read_file(C, tstr, NULL);
+ success = (BKE_read_file(C, tstr, NULL) != BKE_READ_FILE_FAIL);
if(U.themes.first==NULL) {
printf("\nError: No valid startup.blend, fall back to built-in default.\n\n");