Arianna autonomous DAQ firmware

Dependencies:   mbed SDFileSystemFilinfo AriSnProtocol NetServicesMin AriSnComm MODSERIAL PowerControlClkPatch DS1820OW

Revision:
20:e5857b287b3b
Parent:
19:74155d652c37
Child:
21:ce51bb0ba4a5
--- a/SnSDUtils.cpp	Tue Oct 02 01:58:50 2012 +0000
+++ b/SnSDUtils.cpp	Wed Oct 03 00:22:27 2012 +0000
@@ -68,11 +68,16 @@
     const char* fn = GetOutFileName(macadr, run, 0)
         + strlen(kSDsubDir) + 1; // take out dir and '/'s
     
-    DIR* d;
+    DIR* d( opendir(kSDsubDir) );
+    if (d==NULL) {
+        // try making the directory
+        mkdir(kSDsubDir, 0777);
+        d = opendir( kSDsubDir );
+    }
     struct dirent* dent;
     
     uint16_t seq=0, newseq=0;
-    if ( (d = opendir( kSDsubDir ))!=NULL ) {
+    if ( d!=NULL ) {
         // don't compare seq#. don't use num of chars in case seq is >999
         const uint32_t ncomp = strrchr(fn, 's') - fn;
         while ( (dent = readdir(d))!=NULL ) {