summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAidan MacDonald <amachronic@protonmail.com>2024-03-31 18:44:00 +0100
committerAidan MacDonald <amachronic@protonmail.com>2024-03-31 18:45:40 +0100
commite631fc4723adc3a5f151a87d8429399aa34d5217 (patch)
treebb5fb677f1dd229123bfd92d10ca403063ba99db
parent856e3d548bc32402f039f88d09e4df0ce020d1dc (diff)
downloadrockbox-e631fc4723adc3a5f151a87d8429399aa34d5217.tar.gz
rockbox-e631fc4723adc3a5f151a87d8429399aa34d5217.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.c5
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)
820 int rc = 0; 820 int rc = 0;
821 bool exit_func = false; 821 bool exit_func = false;
822 int i = strlen(c->currdir); 822 int i = strlen(c->currdir);
823
824 /* strip trailing slashes */
825 while (c->currdir[i-1] == PATH_SEPCH)
826 i--;
827
823 if (i>1) { 828 if (i>1) {
824 while (c->currdir[i-1]!=PATH_SEPCH) 829 while (c->currdir[i-1]!=PATH_SEPCH)
825 i--; 830 i--;