Skip to content

Fix file browser navigation for non-ASCII folder names#178

Merged
daveallie merged 1 commit intocrosspoint-reader:masterfrom
crosspoint-reader-ko:fix/file-selection-activity
Dec 30, 2025
Merged

Fix file browser navigation for non-ASCII folder names#178
daveallie merged 1 commit intocrosspoint-reader:masterfrom
crosspoint-reader-ko:fix/file-selection-activity

Conversation

@eunchurn
Copy link
Contributor

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

…II names

- Enable UTF-8 long file names in SdFat (USE_UTF8_LONG_NAMES=1)
- Add directory validation before iterating files
- Add rewindDirectory() call for stability
Comment on lines +35 to +36
if (!root || !root.isDirectory()) {
if (root) root.close();
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this check looks strange

  • if outer "if" will not pass, then inner "if" will be not checked
  • if outer "if" will pass, then inner "if" not pass

This just doesn't make sense

Copy link

@gebeto gebeto Dec 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also !root.isDirectory will panic if root will be null, so need to do something like that:

if (!root || (root && !root.isDirectory()) {

or am I missing something?

Copy link
Member

@daveallie daveallie Dec 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks fine to me:

root set and is directory

if (false || false) {
  ... ignored ...
}

root set and is not directory

if (false || true) {
  if (true) root.close();
  return;
}

root not set

if (true || ...this is not checked as the if early returns...) {
  if (false) root.close();
  return;
}

To get past the || condition in the if, root must be set, so root.isDirectory() should not crash

Copy link

@gebeto gebeto Dec 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahhh, I see, thanks for explanation!

Damn, it was confusing 🙈

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@daveallie Thanks for explaining it instead. That’s exactly right!

@daveallie daveallie merged commit 93226c9 into crosspoint-reader:master Dec 30, 2025
1 check passed
Unintendedsideeffects pushed a commit to Unintendedsideeffects/crosspoint-reader that referenced this pull request Feb 17, 2026
…ader#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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants