diff options
author | Aidan MacDonald <amachronic@protonmail.com> | 2024-03-31 18:44:00 +0100 |
---|---|---|
committer | Aidan MacDonald <amachronic@protonmail.com> | 2024-03-31 18:45:40 +0100 |
commit | e631fc4723adc3a5f151a87d8429399aa34d5217 (patch) | |
tree | bb5fb677f1dd229123bfd92d10ca403063ba99db | |
parent | 856e3d548bc32402f039f88d09e4df0ce020d1dc (diff) | |
download | rockbox-e631fc4723.tar.gz rockbox-e631fc4723.zip |
tree: handle trailing slashes in currdir when navigating up
Make ft_exit() ignore trailing slashes. Previously if these
ended up in "currdir" then pressing the back button would just
leave you in the same directory.
Change-Id: Ic539e02a9860fa13ca3235beaf99bb474c66e151
-rw-r--r-- | apps/filetree.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/apps/filetree.c b/apps/filetree.c index 66b5c843ca..11d562f586 100644 --- a/apps/filetree.c +++ b/apps/filetree.c @@ -820,6 +820,11 @@ int ft_exit(struct tree_context* c) int rc = 0; bool exit_func = false; int i = strlen(c->currdir); + + /* strip trailing slashes */ + while (c->currdir[i-1] == PATH_SEPCH) + i--; + if (i>1) { while (c->currdir[i-1]!=PATH_SEPCH) i--; |