Bugfix for:[23234] Blender File Browser - Back Button does work with first directory...
authorDalai Felinto <dfelinto@gmail.com>
Mon, 9 Aug 2010 22:54:40 +0000 (22:54 +0000)
committerDalai Felinto <dfelinto@gmail.com>
Mon, 9 Aug 2010 22:54:40 +0000 (22:54 +0000)
For !WIN32 systems the fix was in ED_fileselect_set_params
(basically adding the first folder in the sfile->folders_prev list)

For WIN32:
I talked with Nathan (Jesterking) and he agreed that the fix in path_util.c was required too. Without that BLI_path_abs was always making WIN32 paths ending with \ to end with \\
(e.g. C:\Blender\ --> C:\Blender\\)
And this was making the folder to fail ISDIR tests.

source/blender/blenlib/intern/path_util.c
source/blender/editors/space_file/filesel.c

index 9a56722b5d91764fa551e439b9e6768442ae95a1..260f59aa03c7bc6eaee4c107471e32fe2b92d958 100644 (file)
@@ -637,6 +637,8 @@ int BLI_path_abs(char *path, const char *basepath)
        
        if (path[0]!='\0') {
                if ( path[strlen(path)-1]=='/') {
+                       /* remove the '/' so we avoid BLI_cleanup_dir adding an extra \ in WIN32 */
+                       path[strlen(path)-1] = '\0';
                        BLI_cleanup_dir(NULL, path);
                } else {
                        BLI_cleanup_file(NULL, path);
index 659763921c72354f6cff7d5c01c2ae7f5103a68d..8783296f5c29871ef5956205a7a5bb933cd04f52 100644 (file)
@@ -206,6 +206,13 @@ short ED_fileselect_set_params(SpaceFile *sfile)
                params->filter = 0;
                params->sort = FILE_SORT_ALPHA;
        }
+
+
+       /* initialize the list with previous folders */
+       if (!sfile->folders_prev)
+               sfile->folders_prev = folderlist_new();
+       folderlist_pushdir(sfile->folders_prev, sfile->params->dir);
+
        return 1;
 }