stridera / oneTesla-Interrupter

The code for the OneTesla SD Interrupter taken from http://onetesla.com/downloads
5 stars 5 forks source link

Question: Why check for isRoot in sdsource.cpp? #1

Closed gmlewis closed 5 years ago

gmlewis commented 5 years ago

On line 193 in sdsource.cpp: https://github.com/stridera/oneTesla-Interrupter/blob/master/src/main/sdsource.cpp#L193 it checks for isRoot and if that fails, it says "Can't switch".

Looking at the SdFat source: https://github.com/adafruit/SD/blob/master/utility/SdFat.h#L219-L222 it says:

  /** \return True if this is a SdFile for the root directory. */
  uint8_t isRoot(void) const {
    return type_ == FAT_FILE_TYPE_ROOT16 || type_ == FAT_FILE_TYPE_ROOT32;
  }

I have an sdcard laid out like this: omd/a-g omd/h-m omd/n-t omd/u-z

This code can cd into omd but can't cd into any of the subdirectories, and the isRoot check seems to be the problem. Is there any reason for including this check?

Thanks!

stridera commented 5 years ago

I'm not sure if it's still this way, but back when I took the code from their site and put it up, the code only allowed going into a single sub-directory. I'm not sure why. You can go look at the latest code and see if it's still like that.