diff --git a/source/blender/blenkernel/intern/blender.c b/source/blender/blenkernel/intern/blender.c index 75c6303d800..2fce1175fe1 100644 --- a/source/blender/blenkernel/intern/blender.c +++ b/source/blender/blenkernel/intern/blender.c @@ -191,7 +191,7 @@ static void clean_paths(Main *main) /* note, this is called on Undo so any slow conversion functions here * should be avoided or check (mode!='u') */ -static void setup_app_data(bContext *C, BlendFileData *bfd, const char *filename) +static void setup_app_data(bContext *C, BlendFileData *bfd, const char *filepath) { bScreen *curscreen= NULL; Scene *curscene= NULL; @@ -295,18 +295,18 @@ static void setup_app_data(bContext *C, BlendFileData *bfd, const char *filename if(recover && bfd->filename[0] && G.relbase_valid) { /* in case of autosave or quit.blend, use original filename instead * use relbase_valid to make sure the file is saved, else we get in the filename */ - filename= bfd->filename; + filepath= bfd->filename; } #if 0 else if (!G.relbase_valid) { /* otherwise, use an empty string as filename, rather than */ - filename=""; + filepath=""; } #endif /* these are the same at times, should never copy to the same location */ - if(G.main->name != filename) - BLI_strncpy(G.main->name, filename, FILE_MAX); + if(G.main->name != filepath) + BLI_strncpy(G.main->name, filepath, FILE_MAX); /* baseflags, groups, make depsgraph, etc */ set_scene_bg(G.main, CTX_data_scene(C)); @@ -353,15 +353,15 @@ void BKE_userdef_free(void) BLI_freelistN(&U.addons); } -int BKE_read_file(bContext *C, const char *dir, ReportList *reports) +int BKE_read_file(bContext *C, const char *filepath, ReportList *reports) { BlendFileData *bfd; int retval= BKE_READ_FILE_OK; - if(strstr(dir, BLENDER_STARTUP_FILE)==NULL) /* dont print user-pref loading */ - printf("read blend: %s\n", dir); + if(strstr(filepath, BLENDER_STARTUP_FILE)==NULL) /* dont print user-pref loading */ + printf("read blend: %s\n", filepath); - bfd= BLO_read_from_file(dir, reports); + bfd= BLO_read_from_file(filepath, reports); if (bfd) { if(bfd->user) retval= BKE_READ_FILE_OK_USERPREFS; @@ -372,10 +372,10 @@ int BKE_read_file(bContext *C, const char *dir, ReportList *reports) retval= BKE_READ_FILE_FAIL; } else - setup_app_data(C, bfd, dir); // frees BFD + setup_app_data(C, bfd, filepath); // frees BFD } else - BKE_reports_prependf(reports, "Loading %s failed: ", dir); + BKE_reports_prependf(reports, "Loading %s failed: ", filepath); return (bfd?retval:BKE_READ_FILE_FAIL); } @@ -521,19 +521,19 @@ void BKE_write_undo(bContext *C, const char *name) /* disk save version */ if(UNDO_DISK) { static int counter= 0; - char tstr[FILE_MAXDIR+FILE_MAXFILE]; + char filepath[FILE_MAXDIR+FILE_MAXFILE]; char numstr[32]; - /* calculate current filename */ + /* calculate current filepath */ counter++; counter= counter % U.undosteps; BLI_snprintf(numstr, sizeof(numstr), "%d.blend", counter); - BLI_make_file_string("/", tstr, btempdir, numstr); + BLI_make_file_string("/", filepath, btempdir, numstr); - success= BLO_write_file(CTX_data_main(C), tstr, G.fileflags, NULL, NULL); + success= BLO_write_file(CTX_data_main(C), filepath, G.fileflags, NULL, NULL); - BLI_strncpy(curundo->str, tstr, sizeof(curundo->str)); + BLI_strncpy(curundo->str, filepath, sizeof(curundo->str)); } else { MemFile *prevfile=NULL; diff --git a/source/blender/blenloader/BLO_readfile.h b/source/blender/blenloader/BLO_readfile.h index 22083eda1c8..b7a1e0dc592 100644 --- a/source/blender/blenloader/BLO_readfile.h +++ b/source/blender/blenloader/BLO_readfile.h @@ -79,12 +79,12 @@ typedef struct BlendFileData { * returns NULL and sets a report in the list if * it cannot open the file. * - * @param file The path of the file to open. + * @param filepath The path of the file to open. * @param reports If the return value is NULL, errors * indicating the cause of the failure. * @return The data of the file. */ -BlendFileData* BLO_read_from_file(const char *file, struct ReportList *reports); +BlendFileData* BLO_read_from_file(const char *filepath, struct ReportList *reports); /** * Open a blender file from memory. The function @@ -209,7 +209,7 @@ int BLO_has_bfile_extension(char *str); */ int BLO_is_a_library(const char *path, char *dir, char *group); -struct Main* BLO_library_append_begin(const struct bContext *C, BlendHandle** bh, char *dir); +struct Main* BLO_library_append_begin(const struct bContext *C, BlendHandle** bh, const char *filepath); /** * Link/Append a named datablock from an external blend file. @@ -217,12 +217,12 @@ struct Main* BLO_library_append_begin(const struct bContext *C, BlendHandle** bh * @param C The context, when NULL instancing object in the scene isnt done. * @param mainl The main database to link from (not the active one). * @param bh The blender file handle. - * @param name The name of the datablock (without the 2 char ID prefix) + * @param idname The name of the datablock (without the 2 char ID prefix) * @param idcode The kind of datablock to link. * @param flag Options for linking, used for instancing. * @return Boolean, 0 when the datablock could not be found. */ -int BLO_library_append_named_part(const struct bContext *C, struct Main *mainl, BlendHandle** bh, const char *name, int idcode, short flag); +int BLO_library_append_named_part(const struct bContext *C, struct Main *mainl, BlendHandle** bh, const char *idname, int idcode, short flag); void BLO_library_append_end(const struct bContext *C, struct Main *mainl, BlendHandle** bh, int idcode, short flag); /* deprecated */ diff --git a/source/blender/blenloader/BLO_writefile.h b/source/blender/blenloader/BLO_writefile.h index 651928aa6a1..5c41350a463 100644 --- a/source/blender/blenloader/BLO_writefile.h +++ b/source/blender/blenloader/BLO_writefile.h @@ -39,7 +39,7 @@ struct MemFile; struct Main; struct ReportList; -extern int BLO_write_file(struct Main *mainvar, char *dir, int write_flags, struct ReportList *reports, int *thumb); +extern int BLO_write_file(struct Main *mainvar, const char *filepath, int write_flags, struct ReportList *reports, int *thumb); extern int BLO_write_file_mem(struct Main *mainvar, struct MemFile *compare, struct MemFile *current, int write_flags); extern int BLO_write_runtime(struct Main *mainvar, const char *file, char *exename, struct ReportList *reports); diff --git a/source/blender/blenloader/intern/readblenentry.c b/source/blender/blenloader/intern/readblenentry.c index 214f637ea6c..028835ee0af 100644 --- a/source/blender/blenloader/intern/readblenentry.c +++ b/source/blender/blenloader/intern/readblenentry.c @@ -251,15 +251,15 @@ void BLO_blendhandle_close(BlendHandle *bh) { /**********/ -BlendFileData *BLO_read_from_file(const char *file, ReportList *reports) +BlendFileData *BLO_read_from_file(const char *filepath, ReportList *reports) { BlendFileData *bfd = NULL; FileData *fd; - fd = blo_openblenderfile(file, reports); + fd = blo_openblenderfile(filepath, reports); if (fd) { fd->reports= reports; - bfd= blo_read_file_internal(fd, file); + bfd= blo_read_file_internal(fd, filepath); blo_freefiledata(fd); } diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index e669be2281d..08b63dd128f 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -487,13 +487,13 @@ static void read_file_version(FileData *fd, Main *main) } -static Main *blo_find_main(FileData *fd, ListBase *mainlist, const char *name, const char *relabase) +static Main *blo_find_main(FileData *fd, ListBase *mainlist, const char *filepath, const char *relabase) { Main *m; Library *lib; char name1[FILE_MAXDIR+FILE_MAXFILE]; - strncpy(name1, name, sizeof(name1)-1); + BLI_strncpy(name1, filepath, sizeof(name1)); cleanup_path(relabase, name1); // printf("blo_find_main: original in %s\n", name); // printf("blo_find_main: converted to %s\n", name1); @@ -511,14 +511,14 @@ static Main *blo_find_main(FileData *fd, ListBase *mainlist, const char *name, c BLI_addtail(mainlist, m); lib= alloc_libblock(&m->library, ID_LI, "lib"); - strncpy(lib->name, name, sizeof(lib->name)-1); + strncpy(lib->name, filepath, sizeof(lib->name)-1); BLI_strncpy(lib->filepath, name1, sizeof(lib->filepath)); m->curlib= lib; read_file_version(fd, m); - if(G.f & G_DEBUG) printf("blo_find_main: added new lib %s\n", name); + if(G.f & G_DEBUG) printf("blo_find_main: added new lib %s\n", filepath); return m; } @@ -944,14 +944,14 @@ static FileData *blo_decode_and_check(FileData *fd, ReportList *reports) /* cannot be called with relative paths anymore! */ /* on each new library added, it now checks for the current FileData and expands relativeness */ -FileData *blo_openblenderfile(const char *name, ReportList *reports) +FileData *blo_openblenderfile(const char *filepath, ReportList *reports) { gzFile gzfile; errno= 0; - gzfile= gzopen(name, "rb"); + gzfile= gzopen(filepath, "rb"); if (gzfile == (gzFile)Z_NULL) { - BKE_reportf(reports, RPT_ERROR, "Unable to open \"%s\": %s.", name, errno ? strerror(errno) : "Unknown error reading file"); + BKE_reportf(reports, RPT_ERROR, "Unable to open \"%s\": %s.", filepath, errno ? strerror(errno) : "Unknown error reading file"); return NULL; } else { FileData *fd = filedata_new(); @@ -959,7 +959,7 @@ FileData *blo_openblenderfile(const char *name, ReportList *reports) fd->read = fd_read_gzip_from_file; /* needed for library_append and read_libraries */ - BLI_strncpy(fd->relabase, name, sizeof(fd->relabase)); + BLI_strncpy(fd->relabase, filepath, sizeof(fd->relabase)); return blo_decode_and_check(fd, reports); } @@ -11750,7 +11750,7 @@ static BHead *read_userdef(BlendFileData *bfd, FileData *fd, BHead *bhead) return bhead; } -BlendFileData *blo_read_file_internal(FileData *fd, const char *filename) +BlendFileData *blo_read_file_internal(FileData *fd, const char *filepath) { BHead *bhead= blo_firstbhead(fd); BlendFileData *bfd; @@ -11762,7 +11762,7 @@ BlendFileData *blo_read_file_internal(FileData *fd, const char *filename) bfd->main->versionfile= fd->fileversion; bfd->type= BLENFILETYPE_BLEND; - strncpy(bfd->main->name, filename, sizeof(bfd->main->name)-1); + strncpy(bfd->main->name, filepath, sizeof(bfd->main->name)-1); while(bhead) { switch(bhead->code) { @@ -12790,7 +12790,7 @@ static void give_base_to_groups(Main *mainvar, Scene *scene) /* returns true if the item was found * but it may already have already been appended/linked */ -static int append_named_part(const bContext *C, Main *mainl, FileData *fd, const char *name, int idcode, short flag) +static int append_named_part(const bContext *C, Main *mainl, FileData *fd, const char *idname, int idcode, short flag) { Scene *scene= CTX_data_scene(C); Object *ob; @@ -12805,9 +12805,9 @@ static int append_named_part(const bContext *C, Main *mainl, FileData *fd, const if(bhead->code==ENDB) endloop= 1; else if(bhead->code==idcode) { - char *idname= bhead_id_name(fd, bhead); + const char *idname_test= bhead_id_name(fd, bhead); - if(strcmp(idname+2, name)==0) { + if(strcmp(idname_test + 2, idname)==0) { found= 1; id= is_yet_read(fd, mainl, bhead); if(id==NULL) { @@ -12859,10 +12859,10 @@ static int append_named_part(const bContext *C, Main *mainl, FileData *fd, const return found; } -int BLO_library_append_named_part(const bContext *C, Main *mainl, BlendHandle** bh, const char *name, int idcode, short flag) +int BLO_library_append_named_part(const bContext *C, Main *mainl, BlendHandle** bh, const char *idname, int idcode, short flag) { FileData *fd= (FileData*)(*bh); - return append_named_part(C, mainl, fd, name, idcode, flag); + return append_named_part(C, mainl, fd, idname, idcode, flag); } static void append_id_part(FileData *fd, Main *mainvar, ID *id, ID **id_r) @@ -12887,7 +12887,7 @@ static void append_id_part(FileData *fd, Main *mainvar, ID *id, ID **id_r) /* common routine to append/link something from a library */ -static Main* library_append_begin(const bContext *C, FileData **fd, char *dir) +static Main* library_append_begin(const bContext *C, FileData **fd, const char *filepath) { Main *mainvar= CTX_data_main(C); Main *mainl; @@ -12896,7 +12896,7 @@ static Main* library_append_begin(const bContext *C, FileData **fd, char *dir) blo_split_main(&(*fd)->mainlist, mainvar); /* which one do we need? */ - mainl = blo_find_main(*fd, &(*fd)->mainlist, dir, G.main->name); + mainl = blo_find_main(*fd, &(*fd)->mainlist, filepath, G.main->name); /* needed for do_version */ mainl->versionfile= (*fd)->fileversion; @@ -12905,10 +12905,10 @@ static Main* library_append_begin(const bContext *C, FileData **fd, char *dir) return mainl; } -Main* BLO_library_append_begin(const bContext *C, BlendHandle** bh, char *dir) +Main* BLO_library_append_begin(const bContext *C, BlendHandle** bh, const char *filepath) { FileData *fd= (FileData*)(*bh); - return library_append_begin(C, &fd, dir); + return library_append_begin(C, &fd, filepath); } static void append_do_cursor(Scene *scene, Library *curlib, short flag) @@ -13030,31 +13030,6 @@ void BLO_library_append_end(const bContext *C, struct Main *mainl, BlendHandle** *bh= (BlendHandle*)fd; } -/* this is a version of BLO_library_append needed by the BPython API, so - * scripts can load data from .blend files -- see Blender.Library module.*/ -/* append to scene */ -/* this should probably be moved into the Python code anyway */ -/* tentatively removed, Python should be able to use the split functions too: */ -/* BLO_library_append_begin, BLO_library_append_end, BLO_library_append_named_part */ -#if 0 -void BLO_script_library_append(BlendHandle **bh, char *dir, const char *name, - int idcode, short flag, Main *mainvar, Scene *scene, ReportList *reports) -{ - FileData *fd= (FileData*)(*bh); - - /* try to append the requested object */ - fd->reports= reports; - library_append(mainvar, scene, name, dir, idcode, 0, &fd, NULL, 0, flag ); - if(fd) fd->reports= NULL; - - /* do we need to do this? */ - if(scene) - DAG_scene_sort(bmain, scene); - - *bh= (BlendHandle*)fd; -} -#endif - /* ************* READ LIBRARY ************** */ static int mainvar_count_libread_blocks(Main *mainvar) diff --git a/source/blender/blenloader/intern/readfile.h b/source/blender/blenloader/intern/readfile.h index b409e456fe6..d4e42ccde16 100644 --- a/source/blender/blenloader/intern/readfile.h +++ b/source/blender/blenloader/intern/readfile.h @@ -113,9 +113,9 @@ struct Main; void blo_join_main(ListBase *mainlist); void blo_split_main(ListBase *mainlist, struct Main *main); -BlendFileData *blo_read_file_internal(FileData *fd, const char *filename); +BlendFileData *blo_read_file_internal(FileData *fd, const char *filepath); -FileData *blo_openblenderfile(const char *name, struct ReportList *reports); +FileData *blo_openblenderfile(const char *filepath, struct ReportList *reports); FileData *blo_openblendermemory(void *buffer, int buffersize, struct ReportList *reports); FileData *blo_openblendermemfile(struct MemFile *memfile, struct ReportList *reports); diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c index d110f71c00b..fa88a44977d 100644 --- a/source/blender/blenloader/intern/writefile.c +++ b/source/blender/blenloader/intern/writefile.c @@ -2521,14 +2521,14 @@ static int write_file_handle(Main *mainvar, int handle, MemFile *compare, MemFil } /* return: success (1) */ -int BLO_write_file(Main *mainvar, char *dir, int write_flags, ReportList *reports, int *thumb) +int BLO_write_file(Main *mainvar, const char *filepath, int write_flags, ReportList *reports, int *thumb) { char userfilename[FILE_MAXDIR+FILE_MAXFILE]; char tempname[FILE_MAXDIR+FILE_MAXFILE+1]; int file, err, write_user_block; /* open temporary file, so we preserve the original in case we crash */ - BLI_snprintf(tempname, sizeof(tempname), "%s@", dir); + BLI_snprintf(tempname, sizeof(tempname), "%s@", filepath); file = open(tempname,O_BINARY+O_WRONLY+O_CREAT+O_TRUNC, 0666); if(file == -1) { @@ -2540,7 +2540,7 @@ int BLO_write_file(Main *mainvar, char *dir, int write_flags, ReportList *report if(write_flags & G_FILE_RELATIVE_REMAP) { char dir1[FILE_MAXDIR+FILE_MAXFILE]; char dir2[FILE_MAXDIR+FILE_MAXFILE]; - BLI_split_dirfile(dir, dir1, NULL); + BLI_split_dirfile(filepath, dir1, NULL); BLI_split_dirfile(mainvar->name, dir2, NULL); /* just incase there is some subtle difference */ @@ -2554,10 +2554,10 @@ int BLO_write_file(Main *mainvar, char *dir, int write_flags, ReportList *report } BLI_make_file_string(G.main->name, userfilename, BLI_get_folder_create(BLENDER_USER_CONFIG, NULL), BLENDER_STARTUP_FILE); - write_user_block= (BLI_path_cmp(dir, userfilename) == 0); + write_user_block= (BLI_path_cmp(filepath, userfilename) == 0); if(write_flags & G_FILE_RELATIVE_REMAP) - makeFilesRelative(mainvar, dir, NULL); /* note, making relative to something OTHER then G.main->name */ + makeFilesRelative(mainvar, filepath, NULL); /* note, making relative to something OTHER then G.main->name */ /* actual file writing */ err= write_file_handle(mainvar, file, NULL,NULL, write_user_block, write_flags, thumb); @@ -2571,12 +2571,12 @@ int BLO_write_file(Main *mainvar, char *dir, int write_flags, ReportList *report int ret; /* first write compressed to separate @.gz */ - BLI_snprintf(gzname, sizeof(gzname), "%s@.gz", dir); + BLI_snprintf(gzname, sizeof(gzname), "%s@.gz", filepath); ret = BLI_gzip(tempname, gzname); if(0==ret) { /* now rename to real file name, and delete temp @ file too */ - if(BLI_rename(gzname, dir) != 0) { + if(BLI_rename(gzname, filepath) != 0) { BKE_report(reports, RPT_ERROR, "Can't change old file. File saved with @."); return 0; } @@ -2592,7 +2592,7 @@ int BLO_write_file(Main *mainvar, char *dir, int write_flags, ReportList *report return 0; } } - else if(BLI_rename(tempname, dir) != 0) { + else if(BLI_rename(tempname, filepath) != 0) { BKE_report(reports, RPT_ERROR, "Can't change old file. File saved with @"); return 0; } diff --git a/source/blender/windowmanager/WM_api.h b/source/blender/windowmanager/WM_api.h index 58645f48787..5ab37e8856a 100644 --- a/source/blender/windowmanager/WM_api.h +++ b/source/blender/windowmanager/WM_api.h @@ -95,7 +95,7 @@ void WM_window_open_temp (struct bContext *C, struct rcti *position, int type); int WM_read_homefile_exec(struct bContext *C, struct wmOperator *op); int WM_read_homefile (struct bContext *C, struct ReportList *reports, short from_memory); int WM_write_homefile (struct bContext *C, struct wmOperator *op); -void WM_read_file (struct bContext *C, const char *name, struct ReportList *reports); +void WM_read_file (struct bContext *C, const char *filepath, struct ReportList *reports); int WM_write_file (struct bContext *C, const char *target, int fileflags, struct ReportList *reports, int copy); void WM_read_autosavefile(struct bContext *C); void WM_autosave_init (struct wmWindowManager *wm); 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); diff --git a/source/blender/windowmanager/wm.h b/source/blender/windowmanager/wm.h index f73652125b1..fd279c31f3c 100644 --- a/source/blender/windowmanager/wm.h +++ b/source/blender/windowmanager/wm.h @@ -78,7 +78,7 @@ void wm_autosave_timer(const bContext *C, wmWindowManager *wm, wmTimer *wt); void wm_autosave_timer_ended(wmWindowManager *wm); void wm_autosave_delete(void); void wm_autosave_read(bContext *C, struct ReportList *reports); -void wm_autosave_location(char *filename); +void wm_autosave_location(char *filepath); /* hack to store circle select size - campbell, must replace with nice operator memory */ #define GESTURE_MEMORY diff --git a/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp b/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp index 832cd8b0651..75181b6c330 100644 --- a/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp +++ b/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp @@ -345,7 +345,9 @@ int main(int argc, char** argv) bool fullScreen = false; bool fullScreenParFound = false; bool windowParFound = false; +#ifdef WIN32 bool closeConsole = true; +#endif RAS_IRasterizer::StereoMode stereomode = RAS_IRasterizer::RAS_STEREO_NOSTEREO; bool stereoWindow = false; bool stereoParFound = false; @@ -570,7 +572,9 @@ int main(int argc, char** argv) break; case 'c': i++; +#ifdef WIN32 closeConsole = false; +#endif break; case 's': // stereo i++;