summaryrefslogtreecommitdiff
path: root/ui.c
diff options
context:
space:
mode:
Diffstat (limited to 'ui.c')
-rw-r--r--ui.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/ui.c b/ui.c
index 26f56cd..3c16be5 100644
--- a/ui.c
+++ b/ui.c
@@ -382,7 +382,9 @@ static char *file_selector_update(Ted *ted, FileSelector *fs) {
size_t path_size = strlen(name) + strlen(cwd) + 3;
char *path = ted_calloc(ted, 1, path_size);
if (path) {
- snprintf(path, path_size - 1, "%s%s%s", cwd, PATH_SEPARATOR_STR, name);
+ snprintf(path, path_size - 1, "%s%s%s", cwd,
+ cwd[strlen(cwd) - 1] == PATH_SEPARATOR ? "" : PATH_SEPARATOR_STR,
+ name);
entries[i].path = path;
entries[i].type = fs_path_type(path);
} else {