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-01 00:34:00 +0400
committerAndrea Weikert <elubie@gmx.net>2009-07-01 00:34:00 +0400
commit60c2599a1a5990c66eb8e7c4d9d9959526a3cc2d (patch)
tree67302fe5ef3d70a6d8174baaf915dd234030552c /source/blender/blenlib
parent406b16e7d19b765bd5567661077d78aa315d8fc0 (diff)
2.5 filebrowser
* show only name of the last directory for the bookmark * small fix of projectfile: header BLI_fileops.h was moved Note: full path should appear in tool tip later, also for renaming bookmarks later on.
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r--source/blender/blenlib/BLI_util.h1
-rw-r--r--source/blender/blenlib/intern/util.c19
2 files changed, 20 insertions, 0 deletions
diff --git a/source/blender/blenlib/BLI_util.h b/source/blender/blenlib/BLI_util.h
index 30c9fc353b3..a138ea780ea 100644
--- a/source/blender/blenlib/BLI_util.h
+++ b/source/blender/blenlib/BLI_util.h
@@ -50,6 +50,7 @@ void BLI_make_existing_file(char *name);
void BLI_split_dirfile(char *string, char *dir, char *file);
void BLI_split_dirfile_basic(const char *string, char *dir, char *file);
void BLI_join_dirfile(char *string, const char *dir, const char *file);
+void BLI_getlastdir(const char* dir, char *last, int maxlen);
int BLI_testextensie(const char *str, const char *ext);
void BLI_uniquename(struct ListBase *list, void *vlink, char defname[], char delim, short name_offs, short len);
void BLI_newname(char * name, int add);
diff --git a/source/blender/blenlib/intern/util.c b/source/blender/blenlib/intern/util.c
index 26f4c2dd415..b9d4daaf5b2 100644
--- a/source/blender/blenlib/intern/util.c
+++ b/source/blender/blenlib/intern/util.c
@@ -736,6 +736,25 @@ void BLI_splitdirstring(char *di, char *fi)
}
}
+void BLI_getlastdir(const char* dir, char *last, int maxlen)
+{
+ char *s = dir;
+ char *lslash = NULL;
+ char *prevslash = NULL;
+ while (*s) {
+ if ((*s == '\\') || (*s == '/')) {
+ prevslash = lslash;
+ lslash = s;
+ }
+ s++;
+ }
+ if (prevslash) {
+ BLI_strncpy(last, prevslash+1, maxlen);
+ } else {
+ BLI_strncpy(last, dir, maxlen);
+ }
+}
+
char *BLI_gethome(void) {
#if !defined(WIN32)
return getenv("HOME");