diff options
| author | Tomas Bzatek <tbzatek@users.sourceforge.net> | 2009-02-28 15:29:50 +0100 |
|---|---|---|
| committer | Tomas Bzatek <tbzatek@users.sourceforge.net> | 2009-02-28 15:29:50 +0100 |
| commit | d9d50c1f90c623c94cdb3437b8ef925fd1e88881 (patch) | |
| tree | 7e95fde2385e0da3a3cbb0ee5f6253cd6b47af59 /src/gallery-utils.c | |
| parent | d8c88d35f8f609110ac1871c1df7a83fd719ff7d (diff) | |
| download | cataract-d9d50c1f90c623c94cdb3437b8ef925fd1e88881.tar.xz | |
Support path holes (non-direct path jumps)
Diffstat (limited to 'src/gallery-utils.c')
| -rw-r--r-- | src/gallery-utils.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/gallery-utils.c b/src/gallery-utils.c index 2b74b9b..b7593fe 100644 --- a/src/gallery-utils.c +++ b/src/gallery-utils.c @@ -265,3 +265,24 @@ remove_tags (char **str, const char *tag_begin, const char *tag_end) } *str = src; } + +/* + * count_dir_levels: returns number of path elements + */ +int +count_dir_levels (const char* path) +{ + int i; + int level; + + if (path == NULL || strlen (path) == 0) + return 0; + + level = 1; + for (i = strlen (path) - 1; i > 0; i--) { + if (G_IS_DIR_SEPARATOR (*(path + i)) && i > 0 && i < strlen (path)) + level++; + } + + return level; +} |
