diff options
Diffstat (limited to 'source/blender/windowmanager/intern/wm_files.c')
-rw-r--r-- | source/blender/windowmanager/intern/wm_files.c | 52 |
1 files changed, 26 insertions, 26 deletions
diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c index 2783504ae90..ea77fca4712 100644 --- a/source/blender/windowmanager/intern/wm_files.c +++ b/source/blender/windowmanager/intern/wm_files.c @@ -333,7 +333,7 @@ static int wm_read_exotic(Scene *UNUSED(scene), const char *name) return retval; } -void WM_read_file(bContext *C, const char *name, ReportList *reports) +void WM_read_file(bContext *C, const char *filepath, ReportList *reports) { int retval; @@ -345,7 +345,7 @@ void WM_read_file(bContext *C, const char *name, ReportList *reports) /* 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) */ - retval= wm_read_exotic(CTX_data_scene(C), name); + retval= wm_read_exotic(CTX_data_scene(C), filepath); /* we didn't succeed, now try to read Blender file */ if (retval == BKE_READ_EXOTIC_OK_BLEND) { @@ -356,7 +356,7 @@ void WM_read_file(bContext *C, const char *name, ReportList *reports) /* also exit screens and editors */ wm_window_match_init(C, &wmbase); - retval= BKE_read_file(C, name, reports); + retval= BKE_read_file(C, filepath, reports); G.save_over = 1; /* this flag is initialized by the operator but overwritten on read. @@ -416,16 +416,16 @@ void WM_read_file(bContext *C, const char *name, ReportList *reports) else if(retval == BKE_READ_EXOTIC_OK_OTHER) BKE_write_undo(C, "Import file"); 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"); + BKE_reportf(reports, RPT_ERROR, "Can't read file: \"%s\", %s.", filepath, 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); + BKE_reportf(reports, RPT_ERROR, "File format is not supported in file: \"%s\".", filepath); } else if(retval == BKE_READ_EXOTIC_FAIL_PATH) { - BKE_reportf(reports, RPT_ERROR, "File path invalid: \"%s\".", name); + BKE_reportf(reports, RPT_ERROR, "File path invalid: \"%s\".", filepath); } else { - BKE_reportf(reports, RPT_ERROR, "Unknown error loading: \"%s\".", name); + BKE_reportf(reports, RPT_ERROR, "Unknown error loading: \"%s\".", filepath); BLI_assert(!"invalid 'retval'"); } @@ -709,7 +709,7 @@ int WM_write_file(bContext *C, const char *target, int fileflags, ReportList *re { Library *li; int len; - char di[FILE_MAX]; + char filepath[FILE_MAX]; int *thumb= NULL; ImBuf *ibuf_thumb= NULL; @@ -726,14 +726,14 @@ int WM_write_file(bContext *C, const char *target, int fileflags, ReportList *re return -1; } - BLI_strncpy(di, target, FILE_MAX); - BLI_replace_extension(di, FILE_MAX, ".blend"); + BLI_strncpy(filepath, target, FILE_MAX); + BLI_replace_extension(filepath, FILE_MAX, ".blend"); /* dont use 'target' anymore */ /* send the OnSave event */ for (li= G.main->library.first; li; li= li->id.next) { - if (BLI_path_cmp(li->filepath, di) == 0) { - BKE_reportf(reports, RPT_ERROR, "Can't overwrite used library '%.200s'", di); + if (BLI_path_cmp(li->filepath, filepath) == 0) { + BKE_reportf(reports, RPT_ERROR, "Can't overwrite used library '%.200s'", filepath); return -1; } } @@ -754,12 +754,12 @@ int WM_write_file(bContext *C, const char *target, int fileflags, ReportList *re ibuf_thumb= blend_file_thumb(CTX_data_scene(C), &thumb); /* rename to .blend1, do this as last before write */ - do_history(di, reports); + do_history(filepath, reports); - if (BLO_write_file(CTX_data_main(C), di, fileflags, reports, thumb)) { + if (BLO_write_file(CTX_data_main(C), filepath, fileflags, reports, thumb)) { if(!copy) { G.relbase_valid = 1; - BLI_strncpy(G.main->name, di, sizeof(G.main->name)); /* is guaranteed current file */ + BLI_strncpy(G.main->name, filepath, sizeof(G.main->name)); /* is guaranteed current file */ G.save_over = 1; /* disable untitled.blend convention */ } @@ -774,7 +774,7 @@ int WM_write_file(bContext *C, const char *target, int fileflags, ReportList *re /* run this function after because the file cant be written before the blend is */ if (ibuf_thumb) { - ibuf_thumb= IMB_thumb_create(di, THB_NORMAL, THB_SOURCE_BLEND, ibuf_thumb); + ibuf_thumb= IMB_thumb_create(filepath, THB_NORMAL, THB_SOURCE_BLEND, ibuf_thumb); IMB_freeImBuf(ibuf_thumb); } @@ -798,20 +798,20 @@ int WM_write_homefile(bContext *C, wmOperator *op) { wmWindowManager *wm= CTX_wm_manager(C); wmWindow *win= CTX_wm_window(C); - char tstr[FILE_MAXDIR+FILE_MAXFILE]; + char filepath[FILE_MAXDIR+FILE_MAXFILE]; int fileflags; /* check current window and close it if temp */ if(win->screen->temp) wm_window_close(C, wm, win); - BLI_make_file_string("/", tstr, BLI_get_folder_create(BLENDER_USER_CONFIG, NULL), BLENDER_STARTUP_FILE); - printf("trying to save homefile at %s ", tstr); + BLI_make_file_string("/", filepath, BLI_get_folder_create(BLENDER_USER_CONFIG, NULL), BLENDER_STARTUP_FILE); + printf("trying to save homefile at %s ", filepath); /* force save as regular blend file */ fileflags = G.fileflags & ~(G_FILE_COMPRESS | G_FILE_AUTOPLAY | G_FILE_LOCK | G_FILE_SIGN); - if(BLO_write_file(CTX_data_main(C), tstr, fileflags, op->reports, NULL) == 0) { + if(BLO_write_file(CTX_data_main(C), filepath, fileflags, op->reports, NULL) == 0) { printf("fail\n"); return OPERATOR_CANCELLED; } @@ -825,7 +825,7 @@ int WM_write_homefile(bContext *C, wmOperator *op) /************************ autosave ****************************/ -void wm_autosave_location(char *filename) +void wm_autosave_location(char *filepath) { char pidstr[32]; #ifdef WIN32 @@ -845,12 +845,12 @@ void wm_autosave_location(char *filename) * If there is no C:\tmp autosave fails. */ if (!BLI_exists(U.tempdir)) { savedir = BLI_get_folder_create(BLENDER_USER_AUTOSAVE, NULL); - BLI_make_file_string("/", filename, savedir, pidstr); + BLI_make_file_string("/", filepath, savedir, pidstr); return; } #endif - BLI_make_file_string("/", filename, U.tempdir, pidstr); + BLI_make_file_string("/", filepath, U.tempdir, pidstr); } void WM_autosave_init(wmWindowManager *wm) @@ -865,7 +865,7 @@ void wm_autosave_timer(const bContext *C, wmWindowManager *wm, wmTimer *UNUSED(w { wmWindow *win; wmEventHandler *handler; - char filename[FILE_MAX]; + char filepath[FILE_MAX]; int fileflags; WM_event_remove_timer(wm, NULL, wm->autosavetimer); @@ -880,13 +880,13 @@ void wm_autosave_timer(const bContext *C, wmWindowManager *wm, wmTimer *UNUSED(w } } - wm_autosave_location(filename); + wm_autosave_location(filepath); /* force save as regular blend file */ fileflags = G.fileflags & ~(G_FILE_COMPRESS|G_FILE_AUTOPLAY |G_FILE_LOCK|G_FILE_SIGN); /* no error reporting to console */ - BLO_write_file(CTX_data_main(C), filename, fileflags, NULL, NULL); + BLO_write_file(CTX_data_main(C), filepath, fileflags, NULL, NULL); /* do timer after file write, just in case file write takes a long time */ wm->autosavetimer= WM_event_add_timer(wm, NULL, TIMERAUTOSAVE, U.savetime*60.0); |