diff options
author | Andrea Weikert <elubie@gmx.net> | 2006-08-20 18:41:13 +0400 |
---|---|---|
committer | Andrea Weikert <elubie@gmx.net> | 2006-08-20 18:41:13 +0400 |
commit | ffe630b452f4abb28c105fca2b8eb9fdb6e72370 (patch) | |
tree | 82f27ea61114c3d66ec8f5bacc393b96af8df12c /source/blender/src/filesel.c | |
parent | 8dd3a792f09a3c1c495c38a37a73c219a8ff02fb (diff) |
Fixes for:
[ #4337 ] Cant refresh the C:\
[ #4710 ] Wrong paths in file selector under user prefs
[ #4353 ] Using ^ char + click on Open/Load = Blender crash
Details:
Fixes for root paths like C:\ on Windows, where Blender still used '/'.
Also contains fixes for relative paths:
- no relative paths for the default dirs (forced to absolute)
- message if using relative paths when .blend file hasn't been saved.
Lastly also added '.' for refresh in root paths. Windows
FindFirstFile/FindNextFile also return '.' and '..', but not in root paths like C:\
Diffstat (limited to 'source/blender/src/filesel.c')
-rw-r--r-- | source/blender/src/filesel.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/source/blender/src/filesel.c b/source/blender/src/filesel.c index bc1bfba9161..da73aa33225 100644 --- a/source/blender/src/filesel.c +++ b/source/blender/src/filesel.c @@ -705,7 +705,9 @@ void parent(SpaceFile *sfile) if( (a = strlen(dir)) ) { if (dir[a-1] != '\\') strcat(dir,"\\"); } - else if(sfile->type!=FILE_MAIN) strcpy(dir,"\\"); + else if(sfile->type!=FILE_MAIN) { + get_default_root(dir); + } #else if( (a = strlen(dir)) ) { /* remove all '/' at the end */ while(dir[a-1] == '/') { @@ -1518,7 +1520,15 @@ static void filesel_execute(SpaceFile *sfile) BLI_strncpy(name, sfile->dir, sizeof(name)); strcat(name, sfile->file); - if(sfile->flag & FILE_STRINGCODE) BLI_makestringcode(G.sce, name); + if(sfile->flag & FILE_STRINGCODE) { + if (!G.relbase_valid) { + okee("You have to save the .blend file before using relative paths! Using absolute path instead."); + sfile->flag & ~FILE_STRINGCODE; + } + else { + BLI_makestringcode(G.sce, name); + } + } sfile->returnfunc(name); } @@ -1549,6 +1559,8 @@ static void do_filesel_buttons(short event, SpaceFile *sfile) BLI_cleanup_dir(G.sce, sfile->dir); BLI_make_file_string(G.sce, butname, sfile->dir, ""); + BLI_strncpy(sfile->dir, butname, sizeof(sfile->dir)); + /* strip the trailing slash if its a real dir */ if (strlen(butname)!=1) butname[strlen(butname)-1]=0; |