From bcb7e33813e0ff76c7744ed80b0a6ae53c518e8f Mon Sep 17 00:00:00 2001 From: Ton Roosendaal Date: Mon, 5 Apr 2004 11:25:25 +0000 Subject: [PATCH] - bugfix #1013 When you try to SHIFT+F1 Link a file, but accidentally choose the current file, the error handling didn't immediately close the file. That can give problems with saving over with CTRL+W. Fix is that filesel.c now prevents selecting the current file. --- source/blender/src/filesel.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/source/blender/src/filesel.c b/source/blender/src/filesel.c index 751fed5d435..0bc79c84ef7 100644 --- a/source/blender/src/filesel.c +++ b/source/blender/src/filesel.c @@ -505,14 +505,18 @@ void test_flags_file(SpaceFile *sfile) if(sfile->type==FILE_BLENDER || sfile->type==FILE_LOADLIB) { if(BLO_has_bfile_extension(file->relname)) { file->flags |= BLENDERFILE; + if(sfile->type==FILE_LOADLIB) { - file->type &= ~S_IFMT; - file->type |= S_IFDIR; + char name[FILE_MAXDIR+FILE_MAXFILE]; + strcpy(name, sfile->dir); + strcat(name, file->relname); + /* prevent current file being used as acceptable dir */ + if (BLI_streq(G.main->name, name)==0) { + file->type &= ~S_IFMT; + file->type |= S_IFDIR; + } } } - else if(BLI_testextensie(file->relname, ".psx")) { - file->flags |= PSXFILE; - } } else if (sfile->type==FILE_SPECIAL){ if(BLI_testextensie(file->relname, ".py")) { file->flags |= PYSCRIPTFILE; @@ -2203,7 +2207,7 @@ static int is_a_library(SpaceFile *sfile, char *dir, char *group) len= strlen(dir); if(len<7) return 0; if( dir[len-1] != '/' && dir[len-1] != '\\') return 0; - + group[0]= 0; dir[len-1]= 0;