neu-rah / ArduinoMenu

Arduino generic menu/interactivity system
GNU Lesser General Public License v2.1
948 stars 191 forks source link

Directories that begin with the same substrings fail to navigate correctly #348

Closed AidanHockey5 closed 3 years ago

AidanHockey5 commented 3 years ago

I'm creating a music player for old video game sound chips and I'm using this library to handle the menu system. I am using an U8G2_SH1106 constructor as well as a SDMenuT object.

Strange behavior arises when two or more directories begin with the same strings in sequential order. This situation is not terribly uncommon, as video game soundtracks often have sequels with similar names. For example:

If I have the following directories in this order on the SD card...

Shining Force
Shining Force II

Notice that these directories are different, but they begin with the same string. Entering the first "Shining Force" folder will work fine. The issue arises when you attempt to access the "Shining Force II" folder. The menu library will enter the first folder instead.

If I were to rename these directories to something along the lines of:

1_Shining_Force
2_Shining_Force

The menu library will function as expected as the two directories no longer begin with the same substring. After poking around a bit through the library, I haven't exactly been able to find where these checks are being performed as everything is fairly abstracted. I thought I'd give you a chance to check it out.

Thank you very much!

AidanHockey5 commented 3 years ago

I have determined that this is actually a bug with the version of SDFat I'm using. I'll create a new issue on that project here