From ffe630b452f4abb28c105fca2b8eb9fdb6e72370 Mon Sep 17 00:00:00 2001 From: Andrea Weikert Date: Sun, 20 Aug 2006 14:41:13 +0000 Subject: 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:\ --- source/blender/src/filesel.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'source/blender/src/filesel.c') 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; -- cgit v1.2.3