|
|
@ -192,13 +192,15 @@ void CardReader::openFile(char* name,bool read) |
|
|
|
char *fname=name; |
|
|
|
|
|
|
|
char *dirname_start,*dirname_end; |
|
|
|
if(name[0]=='/') |
|
|
|
{ |
|
|
|
dirname_start=strchr(name,'/')+1; |
|
|
|
while(dirname_start!=NULL) |
|
|
|
while(dirname_start>0) |
|
|
|
{ |
|
|
|
dirname_end=strchr(dirname_start,'/'); |
|
|
|
//SERIAL_ECHO("start:");SERIAL_ECHOLN((int)(dirname_start-name)); |
|
|
|
//SERIAL_ECHO("end :");SERIAL_ECHOLN((int)(dirname_end-name)); |
|
|
|
if(dirname_end!=NULL && dirname_end>dirname_start) |
|
|
|
if(dirname_end>0 && dirname_end>dirname_start) |
|
|
|
{ |
|
|
|
char subdirname[13]; |
|
|
|
strncpy(subdirname, dirname_start, dirname_end-dirname_start); |
|
|
@ -212,7 +214,7 @@ void CardReader::openFile(char* name,bool read) |
|
|
|
return; |
|
|
|
} |
|
|
|
else |
|
|
|
SERIAL_ECHOLN("dive ok"); |
|
|
|
;//SERIAL_ECHOLN("dive ok"); |
|
|
|
|
|
|
|
curDir=&myDir; |
|
|
|
dirname_start=dirname_end+1; |
|
|
@ -226,7 +228,7 @@ void CardReader::openFile(char* name,bool read) |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
if(read) |
|
|
|
{ |
|
|
|
if (file.open(curDir, fname, O_READ)) |
|
|
@ -242,7 +244,9 @@ void CardReader::openFile(char* name,bool read) |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
SERIAL_PROTOCOLLNPGM("file.open failed"); |
|
|
|
SERIAL_PROTOCOLPGM("open failed, File: "); |
|
|
|
SERIAL_PROTOCOL(fname); |
|
|
|
SERIAL_PROTOCOLLNPGM("."); |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|