-
Notifications
You must be signed in to change notification settings - Fork 60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
open by index and LFN #27
Comments
There is more than one directory entry for each file with a long file name. The only reliable way to get the correct index is to open the file by path and save the index. The short file name entry is used to open the file. It is the last entry in the group. You must have the index of the first entry in the group to get the file name. There can be isolated empty directory entries that can't be used for any lFN file. So don't expect open by index to work if you an index other than to one returned by open by path. |
Open by index on SdFat-beta opens the SFN directory entry and does not determine the LFN offset. I will modify open by index to set the LFN offset. |
I was just finishing this up when I saw you posted another reply. I still wanted to show you how I was using open by index. Here is a better example of how I'm using open by index. The reason I use it this way is I'm displaying a scrollable directory listing and sometimes the directories have 100s of files. Since the memory is limited, keeping the index for the "top" of the list is much easier and I don't have the performance hit of parsing the entire directory multiple times. You can change the library and the USE_SD_BETA define. teensy 3.6. Code:
Using SdFat:
Using SdFat-beta:
|
Try the latest version. getName should work for LFN files opened by index. |
The latest version is working well:
Thanks so much for the quick fix! |
Hi,
I'm currently working on converting a project from SdFat to SdFat-beta so I can ultimately make the change from a teensy 3.6 to a teensy 4. My project uses open by index to navigate through large directories containing many files. Since switching to SdFat-beta I can no longer get an LFN using getName() when the file is opened by index.
Hardware: teensy 3.6
Arduino 1.8.10
Teensyduino 1.48
Using OpenNext as an example I made some changes for troubleshooting. First, I modified the code to use getName().
Running the code like this produces the expected output:
Now I modify the code to use open by index instead of openNext:
With this change getName never returns a LFN.
Any ideas?
On a side note, there may be some strange behavior with isHidden() as well but I have not looked that far into it.
Thanks in advance for your help and thank you so much for the quick teensy 4 support.
The text was updated successfully, but these errors were encountered: