diff options
author | Andrea Weikert <elubie@gmx.net> | 2009-07-28 22:07:00 +0400 |
---|---|---|
committer | Andrea Weikert <elubie@gmx.net> | 2009-07-28 22:07:00 +0400 |
commit | 86336f5cdd2bbe607bbece162bddfade7062b305 (patch) | |
tree | be4ec5b36fa8602ff7cbd7b1548fa90d7c74f693 /source/blender/editors | |
parent | a5e1ff294e9e4b2a8b50f197693283f59eb4ff43 (diff) |
2.5 file browser
Bugfix: revert to previous behaviour of BLI_rename, is used for safe blendfile saving.
Added guard in file browser though to prevent user from invoking this.
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/space_file/file_draw.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/source/blender/editors/space_file/file_draw.c b/source/blender/editors/space_file/file_draw.c index 1074a24f9ae..e807bad28bf 100644 --- a/source/blender/editors/space_file/file_draw.c +++ b/source/blender/editors/space_file/file_draw.c @@ -501,6 +501,8 @@ static void renamebutton_cb(bContext *C, void *arg1, char *oldname) char orgname[FILE_MAX+12]; char filename[FILE_MAX+12]; SpaceFile *sfile= (SpaceFile*)CTX_wm_space_data(C); + ARegion* ar = CTX_wm_region(C); + struct direntry *file = (struct direntry *)arg1; BLI_make_file_string(G.sce, orgname, sfile->params->dir, oldname); @@ -508,10 +510,15 @@ static void renamebutton_cb(bContext *C, void *arg1, char *oldname) BLI_make_file_string(G.sce, newname, sfile->params->dir, filename); if( strcmp(orgname, newname) != 0 ) { - BLI_rename(orgname, newname); - - /* to refresh the file list, does sorting again */ - filelist_free(sfile->files); + if (!BLI_exists(newname)) { + BLI_rename(orgname, newname); + /* to make sure we show what is on disk */ + filelist_free(sfile->files); + } else { + BLI_strncpy(file->relname, oldname, strlen(oldname)+1); + } + + ED_region_tag_redraw(ar); } } |