diff --git a/src/browser.c b/src/browser.c index 9bcecfa..6222945 100644 --- a/src/browser.c +++ b/src/browser.c @@ -275,6 +275,13 @@ char *do_browser(char *path) continue; } #endif + + /* For upcoming strcmp(), remove slash at the end of the + * newpath, as filelist[selected] would never have it. */ + int newpath_len = strlen(newpath); + if (newpath_len > 1 && newpath[newpath_len - 1] == '/') + newpath[newpath_len - 1] = '\0'; + /* In case the specified directory cannot be entered, select it * (if it is in the current list) so it will be highlighted. */ for (i = 0; i < filelist_len; i++)