summaryrefslogtreecommitdiff
path: root/common/treepathutils.c
diff options
context:
space:
mode:
Diffstat (limited to 'common/treepathutils.c')
-rw-r--r--common/treepathutils.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/common/treepathutils.c b/common/treepathutils.c
index d3ace5a..2e43f94 100644
--- a/common/treepathutils.c
+++ b/common/treepathutils.c
@@ -119,6 +119,10 @@ void filelist_tree_print(struct PathTree *tree)
struct PathTree* filelist_tree_find_node_by_path(struct PathTree *tree, const char *path)
{
+ // remove leading './'
+ if (strstr(path, "./") == path) path += 2;
+
+ // remove leading and trailing '/' if present
char *p;
if (IS_DIR_SEP(*path)) p = exclude_trailing_path_sep(path + 1);
else p = exclude_trailing_path_sep(path);
@@ -282,11 +286,14 @@ gboolean filelist_tree_add_item(struct PathTree *tree, const char *path, const c
return FALSE;
}
- if ((strcmp(path, "/") == 0) || (strcmp(path, ".") == 0) || (strcmp(path, "..") == 0)) {
+ if ((strcmp(path, "/") == 0) || (strcmp(path, ".") == 0) || (strcmp(path, "..") == 0) || (strcmp(path, "./") == 0)) {
fprintf(stderr, "filelist_tree_add_item: path '%s' is not a valid path\n", path);
return FALSE;
}
+ // remove leading './'
+ if (strstr(path, "./") == path) path += 2;
+
// remove leading and trailing '/' if present
char *p;
if (IS_DIR_SEP(*path)) p = exclude_trailing_path_sep(path + 1);