Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Montagne <montagne29@wanadoo.fr>2016-06-27 11:54:17 +0300
committerBastien Montagne <montagne29@wanadoo.fr>2016-06-27 13:26:14 +0300
commit5f77266baf20c68befcd2dcffeed67b665f8ccc5 (patch)
tree3bdcb25df20f9902dc65879d245dcfd97142039f /source/blender/editors/space_file/file_utils.c
parent4a641e3cbc3bb57af42672bbf243a6af382eb5a0 (diff)
Fix T48741: File browser back button doesn't work from inside Blend (library) file.
Problem was in fact slightly wider, File space was nearly not taking into account library navigation case and its 'virtual' directoris, except in a few places. Add a wrapper around BLI_is_dir that also check for lib paths, and used it in ED_file_change_dir(), such that we now always check path is a valid directory - in the filebrowser context, not filesytem context. ;)
Diffstat (limited to 'source/blender/editors/space_file/file_utils.c')
-rw-r--r--source/blender/editors/space_file/file_utils.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/source/blender/editors/space_file/file_utils.c b/source/blender/editors/space_file/file_utils.c
index 3c007f25da3..f19e301064d 100644
--- a/source/blender/editors/space_file/file_utils.c
+++ b/source/blender/editors/space_file/file_utils.c
@@ -25,6 +25,9 @@
*/
#include "BLI_rect.h"
+#include "BLI_fileops.h"
+
+#include "BLO_readfile.h"
#include "BKE_context.h"
@@ -45,3 +48,17 @@ void file_tile_boundbox(const ARegion *ar, FileLayout *layout, const int file, r
BLI_rcti_init(r_bounds, xmin, xmin + layout->tile_w + layout->tile_border_x,
ymax - layout->tile_h - layout->tile_border_y, ymax);
}
+
+/* Cannot directly use BLI_is_dir in libloading context... */
+bool file_is_dir(struct SpaceFile *sfile, const char *path)
+{
+ if (sfile->params->type == FILE_LOADLIB) {
+ char tdir[FILE_MAX_LIBEXTRA];
+ char *name;
+ if (BLO_library_path_explode(sfile->params->dir, tdir, NULL, &name) && BLI_is_file(tdir)) {
+ /* .blend file itself and group are considered as directories, not final datablock names. */
+ return name ? false : true;
+ }
+ }
+ return BLI_is_dir(path);
+}