From 3340a184613daafdc2260be4ff883d8a30b10220 Mon Sep 17 00:00:00 2001 From: Bertrand Songis Date: Wed, 19 Feb 2014 15:23:13 +0100 Subject: [PATCH] Fix for simu running on VirtualBox mounted directories --- radio/src/simpgmspace.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/radio/src/simpgmspace.cpp b/radio/src/simpgmspace.cpp index cd3fb4803..a60143dda 100644 --- a/radio/src/simpgmspace.cpp +++ b/radio/src/simpgmspace.cpp @@ -550,9 +550,11 @@ FRESULT f_readdir (DIR * rep, FILINFO * fil) fil->fattrib = (ent->d_type == DT_DIR ? AM_DIR : 0); #else if (ent->d_type == simu::DT_UNKNOWN) { + fil->fattrib = 0; struct stat buf; - lstat(ent->d_name, &buf); - fil->fattrib = (S_ISDIR(buf.st_mode) ? AM_DIR : 0); + if (stat(ent->d_name, &buf) == 0) { + fil->fattrib = (S_ISDIR(buf.st_mode) ? AM_DIR : 0); + } } else { fil->fattrib = (ent->d_type == simu::DT_DIR ? AM_DIR : 0); @@ -563,6 +565,7 @@ FRESULT f_readdir (DIR * rep, FILINFO * fil) memset(fil->lfname, 0, SD_SCREEN_FILE_LENGTH); strncpy(fil->fname, ent->d_name, 13-1); strcpy(fil->lfname, ent->d_name); + // TRACE("f_readdir(): %s", fil->fname); return FR_OK; }