2.5 filebrowser
authorAndrea Weikert <elubie@gmx.net>
Sun, 20 Sep 2009 19:10:12 +0000 (19:10 +0000)
committerAndrea Weikert <elubie@gmx.net>
Sun, 20 Sep 2009 19:10:12 +0000 (19:10 +0000)
* fix crash in autocomplete for very long paths
* allow longer paths in directory button
* added some TODO comments for G.lib

source/blender/editors/space_file/file_draw.c
source/blender/editors/space_file/filesel.c
source/blender/windowmanager/intern/wm_operators.c

index 00024ffa961b9eb857bf504647ac8fcdfbe749fe..46ed6987752e4d58331c6754eea8f2913761f56b 100644 (file)
@@ -189,7 +189,7 @@ void file_draw_buttons(const bContext *C, ARegion *ar)
        if (available_w > 0) {
                but = uiDefBut(block, TEX, B_FS_DIRNAME, "",
                         min_x, line1_y, line1_w, btn_h, 
-                        params->dir, 0.0, (float)FILE_MAXDIR-1, 0, 0, 
+                        params->dir, 0.0, (float)FILE_MAX-1, 0, 0, 
                         "File path.");
                uiButSetCompleteFunc(but, autocomplete_directory, NULL);
                uiDefBut(block, TEX, B_FS_FILENAME, "",
index e9e09d8f60b2cce3c1ce512bf49cb887c8b6d453..dd16a4268992df01c6f5cf437fa2f84304b11e9b 100644 (file)
@@ -417,13 +417,16 @@ void autocomplete_directory(struct bContext *C, char *str, void *arg_v)
                        struct direntry* file = filelist_file(sfile->files, i);
                        const char* dir = filelist_dir(sfile->files);
                        if (file && S_ISDIR(file->type))        {
-                               BLI_make_file_string(G.sce, tmp, dir, file->relname);
+                               // BLI_make_file_string(G.sce, tmp, dir, file->relname);
+                               BLI_join_dirfile(tmp, dir, file->relname);
                                autocomplete_do_name(autocpl,tmp);
                        }
                }
                autocomplete_end(autocpl, str);
                if (BLI_exists(str)) {
                        BLI_add_slash(str);
+               } else {
+                       BLI_make_exist(str);
                }
        }
 }
index a6fc575ce703bae4a18f28b604d0d1bbf5d4ce6d..76c15043b89d155f1ab8f4337cca3fcc471c9c7a 100644 (file)
@@ -943,7 +943,7 @@ static int wm_link_append_invoke(bContext *C, wmOperator *op, wmEvent *event)
                return WM_operator_call(C, op);
        } 
        else {
-               /* XXX solve where to get last linked library from */
+               /* XXX TODO solve where to get last linked library from */
                RNA_string_set(op->ptr, "path", G.lib);
                WM_event_add_fileselect(C, op);
                return OPERATOR_RUNNING_MODAL;
@@ -1064,6 +1064,8 @@ static int wm_link_append_exec(bContext *C, wmOperator *op)
        DAG_ids_flush_update(0);
 
        BLO_blendhandle_close(bh);
+
+       /* XXX TODO: align G.lib with other directory storage (like last opened image etc...) */
        BLI_strncpy(G.lib, dir, FILE_MAX);
 
        WM_event_add_notifier(C, NC_WINDOW, NULL);