diff options
author | Daniel Stenberg <daniel@haxx.se> | 2002-05-07 11:46:37 +0000 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2002-05-07 11:46:37 +0000 |
commit | 8ae29ff4b2552f6c91c9a1b55d82fb9d8452bf7d (patch) | |
tree | 324f0959c45373980e0f6f396ec8320abe4d7bd9 | |
parent | 48521063ce26e015603b88e49eaf993512b17c25 (diff) | |
download | rockbox-8ae29ff4b2552f6c91c9a1b55d82fb9d8452bf7d.tar.gz rockbox-8ae29ff4b2552f6c91c9a1b55d82fb9d8452bf7d.zip |
is_dir() is removed, we now read the 'attribute' field from the dirent
struct. This is supposed to work with the X11 simulator as of now, and I
trust that the win32 one will grok this pretty soon too!
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@491 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | uisimulator/tree.c | 14 |
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 | ||
53 | bool 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 | |||
63 | int static | 53 | int static |
64 | showdir(char *path, struct entry *buffer, int start, int scrollpos, int* at_end) | 54 | showdir(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; |