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:
authorAndrea Weikert <elubie@gmx.net>2009-07-10 23:19:54 +0400
committerAndrea Weikert <elubie@gmx.net>2009-07-10 23:19:54 +0400
commitac11d522c8cad7eeabe07e643effbc776e933728 (patch)
tree32809399cfb65a5a4f002b883736932cb9f1baa9 /source/blender/blenlib
parenta74edc0caf2380bd92aa812835a1b5f922f2ca56 (diff)
2.5 filebrowser
* bugfix: don't allow parent dir to go beyond root * bugfix: only attempt to change directory if it exists New (WIP) feature: autocomplete for directory * works on TAB * so far only one level (in current directory)
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r--source/blender/blenlib/BLI_util.h3
-rw-r--r--source/blender/blenlib/intern/util.c16
2 files changed, 19 insertions, 0 deletions
diff --git a/source/blender/blenlib/BLI_util.h b/source/blender/blenlib/BLI_util.h
index a138ea780ea..d323f701ba5 100644
--- a/source/blender/blenlib/BLI_util.h
+++ b/source/blender/blenlib/BLI_util.h
@@ -72,6 +72,9 @@ void BLI_cleanup_dir(const char *relabase, char *dir); /* same as above but adds
/* go back one directory */
int BLI_parent_dir(char *path);
+/* return whether directory is root and thus has no parent dir */
+int BLI_has_parent(char *path);
+
/**
* Blender's path code replacement function.
* Bases @a path strings leading with "//" by the
diff --git a/source/blender/blenlib/intern/util.c b/source/blender/blenlib/intern/util.c
index 838648ebfd7..a236defc515 100644
--- a/source/blender/blenlib/intern/util.c
+++ b/source/blender/blenlib/intern/util.c
@@ -494,6 +494,22 @@ void BLI_makestringcode(const char *relfile, char *file)
}
}
+int BLI_has_parent(char *path)
+{
+ int len;
+ int slashes = 0;
+ BLI_clean(path);
+ BLI_add_slash(path);
+
+ len = strlen(path)-1;
+ while (len) {
+ if ((path[len] == '\\') || (path[len] == '/'))
+ slashes++;
+ len--;
+ }
+ return slashes > 1;
+}
+
int BLI_parent_dir(char *path)
{
#ifdef WIN32