Go Down

Topic: SdFat: How to go to parent directory? (Read 2846 times) previous topic - next topic


I wonder how to go to the parent directory with SdFat.

SdFat sd;
sd.vwd()->chdir("..") does nothing
sd.vwd()->chdir() goes to the root directory

Any hints?

Thanks, Oliver


There is not a supported way.

I wrote a function:
Code: [Select]
  /** experimental don't use */
  bool openParent(SdBaseFile* dir);

I made it private since I was not to happy with the design.  No one asked for it so I didn't follow up.

You could edit SdBaseFile.h at about line 358 and make it public.  I may not work since I wrote it a long time ago.



Thanks a lot for the quick reply. I made openParent a public member, but the following code does not work:

Code: [Select]

      if ( !sd.vwd()->isRoot() )

Maybe I used this procedure in a wrong way. What would be a proper way to call "openParent"?

I am working on a file selection box (LCD), where the user should be able to navigate through the folder hierachy. For this purpose my idea was to modify "vwd".

Thanks, Oliver

Go Up