summaryrefslogtreecommitdiff
path: root/uisimulator/tree.c
diff options
context:
space:
mode:
Diffstat (limited to 'uisimulator/tree.c')
-rw-r--r--uisimulator/tree.c14
1 files changed, 2 insertions, 12 deletions
diff --git a/uisimulator/tree.c b/uisimulator/tree.c
index d59718d17c..c8d15ac5b9 100644
--- a/uisimulator/tree.c
+++ b/uisimulator/tree.c
@@ -50,16 +50,6 @@ struct entry {
50 50
51#ifdef HAVE_LCD_BITMAP 51#ifdef HAVE_LCD_BITMAP
52 52
53bool is_dir(char* path)
54{
55 DIR* dir = opendir(path);
56 if(dir) {
57 closedir(dir);
58 return TRUE;
59 }
60 return FALSE;
61}
62
63int static 53int static
64showdir(char *path, struct entry *buffer, int start, int scrollpos, int* at_end) 54showdir(char *path, struct entry *buffer, int start, int scrollpos, int* at_end)
65{ 55{
@@ -91,7 +81,7 @@ showdir(char *path, struct entry *buffer, int start, int scrollpos, int* at_end)
91 else 81 else
92 memcpy(buffer[i].name, "too long", 9); 82 memcpy(buffer[i].name, "too long", 9);
93 83
94 buffer[i].file = TRUE; /* files only for now */ 84 buffer[i].file = !(entry->attribute&ATTR_DIRECTORY);
95 85
96 if(len < TREE_MAX_LEN_DISPLAY) 86 if(len < TREE_MAX_LEN_DISPLAY)
97 lcd_puts(LINE_X, LINE_Y+i*LINE_HEIGTH, buffer[i].name, 0); 87 lcd_puts(LINE_X, LINE_Y+i*LINE_HEIGTH, buffer[i].name, 0);
@@ -191,7 +181,7 @@ bool dirbrowse(char *root)
191 sprintf(buf,"%s/%s",currdir,buffer[dircursor].name); 181 sprintf(buf,"%s/%s",currdir,buffer[dircursor].name);
192 } 182 }
193 183
194 if (is_dir(buf)) { 184 if (!buffer[dircursor].file) {
195 memcpy(currdir,buf,sizeof(currdir)); 185 memcpy(currdir,buf,sizeof(currdir));
196 dircursor=0; 186 dircursor=0;
197 start=0; 187 start=0;