Subdirectory provided by Embedded Artists

Dependencies:   DM_FATFileSystem DM_HttpServer DM_USBHost EthernetInterface USBDevice mbed-rpc mbed-rtos mbed-src

Dependents:   lpc4088_displaymodule_hello_world_Sept_2018

Fork of DMSupport by Embedded Artists

Revision:
14:c21497031b1f
Parent:
9:a33326afd686
Child:
19:2efb6f5f69a4
diff -r 2c60e28503f8 -r c21497031b1f FileSystems/QSPIFileSystem.cpp
--- a/FileSystems/QSPIFileSystem.cpp	Fri Dec 19 12:10:19 2014 +0100
+++ b/FileSystems/QSPIFileSystem.cpp	Fri Dec 19 16:41:25 2014 +0100
@@ -1402,16 +1402,18 @@
 
 DirHandle *QSPIFileSystem::opendir(const char *name)
 {
-  FileHandle* fh = open(name, O_RDONLY);
-  if (fh != NULL) {
-    // Attempting to open a file as a dir
-    delete fh;
-    return NULL;
-  }
-  
-//     printf("opendir: name '%s'\n", name);
-  if (strlen(name) <= HEADER_DNAME_MAXLEN) {
-    return QSPIDirHandle::openDir(name);
+  if (isformatted()) {
+    FileHandle* fh = open(name, O_RDONLY);
+    if (fh != NULL) {
+      // Attempting to open a file as a dir
+      delete fh;
+      return NULL;
+    }
+    
+//       printf("opendir: name '%s'\n", name);
+    if (strlen(name) <= HEADER_DNAME_MAXLEN) {
+      return QSPIDirHandle::openDir(name);
+    }
   }
   return NULL;
 }