macOS: normalize SDMC directory filenames#2080
macOS: normalize SDMC directory filenames#2080RigleGit wants to merge 1 commit intoazahar-emu:masterfrom
Conversation
|
Welcome to the Azahar Emulator repository! Due to the surge of AI bots we have decided to add an extra verification step to new contributors. Please follow the exact instructions in your own written Pull Request description to reopen it. |
|
@RigleGit Azahar |
|
Verification successful! Pull request has been reopened. Please also edit your PR description to remove the block of text between |
PabloMK7
left a comment
There was a problem hiding this comment.
Thanks for the chnage! A few minor notes.
|
|
||
| // macOS filesystems may expose decomposed Unicode names through directory listings. | ||
| // Normalize to NFC before passing names to guest APIs that expect stable text. | ||
| std::string NormalizeUTF8ToNFC(std::string_view input) { |
There was a problem hiding this comment.
Can you change this function name a bit? The name NormalizeNFDToNFC seems more appropriate.
| const std::string& filename = file.virtualName; | ||
| // Directory entries are exposed to the guest as UTF-16. Normalize host UTF-8 names first | ||
| // so host Unicode normalization differences do not leak into guest-visible SDMC paths. | ||
| const std::string filename = Common::NormalizeUTF8ToNFC(file.virtualName); |
There was a problem hiding this comment.
I think this should be put between #ifdefs APPLE, as well as the entire normalize function itself. That way it is not left in the executable when not needed.
| return entries_read; | ||
| } | ||
|
|
||
|
|
This PR fixes #2079.
Tested with my homebrew on macOS 15.7.5, and not it works perfectly.
AI disclosure: I used ChatGPT/Codex (GPT-5.5 Low) to help me understand the issue, discuss possible locations in the filesystem code, and review some code. The final patch was reviewed, edited and tested manually.