change to r57261, replace BLI_cleanup_dir with BLI_split_dir_part
authorCampbell Barton <ideasman42@gmail.com>
Thu, 6 Jun 2013 23:58:30 +0000 (23:58 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Thu, 6 Jun 2013 23:58:30 +0000 (23:58 +0000)
source/blender/editors/space_file/filesel.c

index 0410307ba9438c7aadc675fc0bd071399c05510c..25d865d857b761b5b792b3041c330211b464d0ec 100644 (file)
@@ -254,8 +254,19 @@ short ED_fileselect_set_params(SpaceFile *sfile)
        /* initialize the list with previous folders */
        if (!sfile->folders_prev)
                sfile->folders_prev = folderlist_new();
-       if (!sfile->params->dir[0])
-               BLI_cleanup_dir(G.main->name, sfile->params->dir);
+
+       if (!sfile->params->dir[0]) {
+               if (G.main->name[0]) {
+                       BLI_split_dir_part(G.main->name, sfile->params->dir, sizeof(sfile->params->dir));
+               }
+               else {
+                       const char *doc_path = BLI_getDefaultDocumentFolder();
+                       if (doc_path) {
+                               BLI_strncpy(sfile->params->dir, doc_path, sizeof(sfile->params->dir));
+                       }
+               }
+       }
+
        folderlist_pushdir(sfile->folders_prev, sfile->params->dir);
 
        /* switching thumbnails needs to recalc layout [#28809] */