1
0
Fork 0
forked from len0rd/rockbox

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
This commit is contained in:
Daniel Stenberg 2002-05-07 11:46:37 +00:00
parent 48521063ce
commit 8ae29ff4b2

View file

@ -50,16 +50,6 @@ struct entry {
#ifdef HAVE_LCD_BITMAP #ifdef HAVE_LCD_BITMAP
bool is_dir(char* path)
{
DIR* dir = opendir(path);
if(dir) {
closedir(dir);
return TRUE;
}
return FALSE;
}
int static int static
showdir(char *path, struct entry *buffer, int start, int scrollpos, int* at_end) showdir(char *path, struct entry *buffer, int start, int scrollpos, int* at_end)
{ {
@ -91,7 +81,7 @@ showdir(char *path, struct entry *buffer, int start, int scrollpos, int* at_end)
else else
memcpy(buffer[i].name, "too long", 9); memcpy(buffer[i].name, "too long", 9);
buffer[i].file = TRUE; /* files only for now */ buffer[i].file = !(entry->attribute&ATTR_DIRECTORY);
if(len < TREE_MAX_LEN_DISPLAY) if(len < TREE_MAX_LEN_DISPLAY)
lcd_puts(LINE_X, LINE_Y+i*LINE_HEIGTH, buffer[i].name, 0); lcd_puts(LINE_X, LINE_Y+i*LINE_HEIGTH, buffer[i].name, 0);
@ -191,7 +181,7 @@ bool dirbrowse(char *root)
sprintf(buf,"%s/%s",currdir,buffer[dircursor].name); sprintf(buf,"%s/%s",currdir,buffer[dircursor].name);
} }
if (is_dir(buf)) { if (!buffer[dircursor].file) {
memcpy(currdir,buf,sizeof(currdir)); memcpy(currdir,buf,sizeof(currdir));
dircursor=0; dircursor=0;
start=0; start=0;