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>2015-01-04 19:54:12 +0300
committerBastien Montagne <montagne29@wanadoo.fr>2015-01-04 19:57:39 +0300
commita08c5e1183731cdafd85ecf51c587cabf39da19b (patch)
treee7fa1d7173f4614130d73d08c79cff457dd6b64b /source/blender/blenlib
parent8abdc89912e4ae042eeeb5f0e33e833a89eefb8f (diff)
Partial fix for T43113: Filebrowser: Empty folders do not contain go back arrow.
Do not allow going into un-readable directories at all. Note we might want to reflect that 'state' in UI for users too, but that will be for later. Also, not quite sure this fix the windows case, will have to start my VM... :/
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r--source/blender/blenlib/intern/path_util.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/source/blender/blenlib/intern/path_util.c b/source/blender/blenlib/intern/path_util.c
index 8b570189e29..3fff22218e2 100644
--- a/source/blender/blenlib/intern/path_util.c
+++ b/source/blender/blenlib/intern/path_util.c
@@ -1087,18 +1087,22 @@ void BLI_char_switch(char *string, char from, char to)
}
/**
- * Strips off nonexistent subdirectories from the end of *dir, leaving the path of
- * the lowest-level directory that does exist.
+ * Strips off nonexistent (or non-accessible) subdirectories from the end of *dir, leaving the path of
+ * the lowest-level directory that does exist and we can read.
*/
void BLI_make_exist(char *dir)
{
int a;
+ char par_path[PATH_MAX + 3];
BLI_char_switch(dir, ALTSEP, SEP);
a = strlen(dir);
- while (!BLI_is_dir(dir)) {
+ for (BLI_join_dirfile(par_path, sizeof(par_path), dir, "..");
+ !(BLI_is_dir(dir) && BLI_exists(par_path));
+ BLI_join_dirfile(par_path, sizeof(par_path), dir, ".."))
+ {
a--;
while (dir[a] != SEP) {
a--;