From 5af4dab5f06316395d1507455284d7f8c588f9e2 Mon Sep 17 00:00:00 2001 From: Nick Treleaven Date: Fri, 6 Jul 2012 13:17:54 +0100 Subject: [PATCH] Fix showing project name in sidebar documents This was broken if the base path ended with a directory separator. --- src/sidebar.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/sidebar.c b/src/sidebar.c index 2e1000f2..cbe0c050 100644 --- a/src/sidebar.c +++ b/src/sidebar.c @@ -368,8 +368,9 @@ static gchar *get_doc_folder(const gchar *path) { gsize len = strlen(project_base_path); + /* remove trailing separator so we can match base path exactly */ if (project_base_path[len-1] == G_DIR_SEPARATOR) - project_base_path[len-1] = '\0'; + project_base_path[--len] = '\0'; /* check whether the dir name matches or uses the project base path */ if (utils_filename_has_prefix(tmp_dirname, project_base_path))