Files
BearddOddity 8f6c290cf0 kernel_path: match file names ignoring case on POSIX hosts
The Xbox's file systems ignore case and titles rely on it: a title asks for
D:\Data\movies\INTRO.bik where the disc has Movies/intro.bik. A POSIX host's
file system does not, so the open failed with "not found" and the title
carried on without the file.

On POSIX, after the guest path is translated, each component that is not
there as spelled takes the spelling of the one directory entry that
matches it ignoring case. A path that exists as spelled costs one lstat. A
component nothing matches (a file about to be created) and everything after
it stays as the title asked. Windows and macOS file systems are already
case-insensitive and are untouched (the code is in the POSIX half only, and
on macOS the first lstat succeeds).

Test: tests/kernel_path gets a POSIX-only section. A tree Data/Movies/intro.bik
is translated from the spellings Data\Movies\intro.bik (unchanged),
Data\movies\INTRO.bik, DATA\MOVIES\Intro.BIK (folded), data\movies\New.bin
(directories fold, the new file keeps its name) and Nope\Sub\x.bin (nothing
matches, unchanged).

Verified: on Linux x86-64 (gcc) the section passes with this change and three
checks fail with kernel_path.c at v0.16.0. kernel_directory_posix,
kernel_file_relative, kernel_fatx_overwrite and kernel_file_status pass on
Linux; kernel_path passes on Windows (MSVC), where the section is skipped.

Not covered: non-ASCII names (the match is strcasecmp).

Blast radius: path translation on POSIX hosts, for paths that do not exist as
spelled.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-21 04:35:45 -05:00
..