2.5 filebrowser
authorAndrea Weikert <elubie@gmx.net>
Sun, 20 Sep 2009 18:26:02 +0000 (18:26 +0000)
committerAndrea Weikert <elubie@gmx.net>
Sun, 20 Sep 2009 18:26:02 +0000 (18:26 +0000)
more bugfixes:
* removed refreshing code at file_init again, causes issues when resizing
* free library in the filelist after use
* make sure directory exists when library file for append/link doesn't exist, so browsing can continue from valid dir.

source/blender/editors/space_file/file_ops.c
source/blender/editors/space_file/filelist.c
source/blender/editors/space_file/space_file.c

index 16c8733cb5b4c5e8df50579ad9d49cac3b962bc3..70d8de7d5090938b22e6b9b62057cc4f34b7a95c 100644 (file)
@@ -518,6 +518,7 @@ int file_cancel_exec(bContext *C, wmOperator *unused)
        sfile->op = NULL;
        
        if (sfile->files) {
+               filelist_freelib(sfile->files);
                filelist_free(sfile->files);
                MEM_freeN(sfile->files);
                sfile->files= NULL;
@@ -606,6 +607,7 @@ int file_exec(bContext *C, wmOperator *unused)
                fsmenu_write_file(fsmenu_get(), name);
                WM_event_fileselect_event(C, op, EVT_FILESELECT_EXEC);
 
+               filelist_freelib(sfile->files);
                filelist_free(sfile->files);
                MEM_freeN(sfile->files);
                sfile->files= NULL;
index 582a5997ef5016ff1e8103f31404587fef909cc3..8257aa5482fd8b8e5891f217602dba8f7eb83552 100644 (file)
@@ -804,6 +804,8 @@ static void filelist_read_library(struct FileList* filelist)
        if(!filelist->libfiledata) {
                int num;
                struct direntry *file;
+
+               BLI_make_exist(filelist->dir);
                filelist_read_dir(filelist);
                file = filelist->filelist;
                for(num=0; num<filelist->numfiles; num++, file++) {
index 99d649b28cc3db4305abe6d6457f72c4d6738053..56dbdcbc645dae6cc58c87c1904f3227f968eb0e 100644 (file)
@@ -156,16 +156,6 @@ static void file_free(SpaceLink *sl)
 static void file_init(struct wmWindowManager *wm, ScrArea *sa)
 {
        SpaceFile *sfile= (SpaceFile*)sa->spacedata.first;
-       if(sfile->params) {
-               MEM_freeN(sfile->params);
-               sfile->params = 0;
-               ED_fileselect_set_params(sfile);
-               if (sfile->files) {
-                       filelist_free(sfile->files);
-                       MEM_freeN(sfile->files);
-                       sfile->files= NULL;
-               }
-       }
        printf("file_init\n");
 }
 
@@ -213,6 +203,7 @@ static void file_refresh(const bContext *C, ScrArea *sa)
        if (filelist_empty(sfile->files))
        {
                filelist_readdir(sfile->files);
+               BLI_strncpy(params->dir, filelist_dir(sfile->files), FILE_MAX);
        }
        if(params->sort!=FILE_SORT_NONE) filelist_sort(sfile->files, params->sort);