Fix file browser navigation for non-ASCII folder names (#178)
## Summary * **What is the goal of this PR?** Fix file browser failing to navigate into subdirectories with non-ASCII (Korean/Unicode) folder names. * **What changes are included?** - Enable UTF-8 long file names in SdFat (`USE_UTF8_LONG_NAMES=1`) - Add directory validation before iterating files - Add `rewindDirectory()` call for stability ## Additional Context
This commit is contained in:
@@ -26,6 +26,8 @@ build_flags =
|
|||||||
-DXML_GE=0
|
-DXML_GE=0
|
||||||
-DXML_CONTEXT_BYTES=1024
|
-DXML_CONTEXT_BYTES=1024
|
||||||
-std=c++2a
|
-std=c++2a
|
||||||
|
# Enable UTF-8 long file names in SdFat
|
||||||
|
-DUSE_UTF8_LONG_NAMES=1
|
||||||
|
|
||||||
; Board configuration
|
; Board configuration
|
||||||
board_build.flash_mode = dio
|
board_build.flash_mode = dio
|
||||||
|
|||||||
@@ -30,7 +30,15 @@ void FileSelectionActivity::taskTrampoline(void* param) {
|
|||||||
void FileSelectionActivity::loadFiles() {
|
void FileSelectionActivity::loadFiles() {
|
||||||
files.clear();
|
files.clear();
|
||||||
selectorIndex = 0;
|
selectorIndex = 0;
|
||||||
|
|
||||||
auto root = SdMan.open(basepath.c_str());
|
auto root = SdMan.open(basepath.c_str());
|
||||||
|
if (!root || !root.isDirectory()) {
|
||||||
|
if (root) root.close();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
root.rewindDirectory();
|
||||||
|
|
||||||
char name[128];
|
char name[128];
|
||||||
for (auto file = root.openNextFile(); file; file = root.openNextFile()) {
|
for (auto file = root.openNextFile(); file; file = root.openNextFile()) {
|
||||||
file.getName(name, sizeof(name));
|
file.getName(name, sizeof(name));
|
||||||
|
|||||||
Reference in New Issue
Block a user