fix: match a cuesheet's filename however it is capitalised - #67
Merged
Conversation
Three Final Fantasy VII discs failed to install with invalid cuesheet: Final Fantasy VII Disc 1.cue references FINAL FANTASY VII DISC 1.BIN, which is missing against a file the user could plainly see was there. The rip is from 2003 and its sheet says FILE "FINAL FANTASY VII DISC 1.BIN" BINARY beside a file called "Final Fantasy VII Disc 1.bin". Cuesheets are routinely written on Windows, where the case of a filename is not information, so this rip works everywhere except a case-sensitive filesystem. A FILE reference now falls back to a case-insensitive match in the sheet's own directory. The exact name always wins and the directory is only read when the exact name does not resolve, so nothing is slower and no ambiguity is introduced where the filesystem itself has none. A name that matches nothing is returned unchanged, so the error still quotes what the sheet actually said. BinName keeps the name as written, because that is what an error should quote and what an archive's own listing agrees with; only the resolved path changes. This also fixes a quieter symptom. The scanner excludes the tracks a cuesheet names so that one rip is one title, and that exclusion is by path -- so a sheet whose case did not match left its .bin unexcluded and listed as a title of its own, beside the game it belongs to. Only the on-disk path was affected. Inside an archive the data track is chosen from the listing rather than by name, which is why these titles scanned correctly and then failed at conversion. Claude-Session: https://claude.ai/code/session_018eBAB3V9GRxNwgpQcpGje4
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Three Final Fantasy VII discs failed to install:
against a file plainly sitting right there. The archive holds:
and the sheet — a 2003 rip — says:
Cuesheets are routinely written on Windows, where the case of a filename carries no information. The rip is fine; it works everywhere except a case-sensitive filesystem.
Change
A
FILEreference now falls back to a case-insensitive match within the sheet's own directory.BinNamekeeps the name as written: that is what an error should quote and what an archive listing agrees with. Only the resolved path changes.A quieter symptom it also fixes
The scanner excludes the tracks a cuesheet names, so that one rip is one title rather than several files. That exclusion is by path — so a sheet whose case didn't match left its
.binunexcluded and listed as a title of its own, beside the game it belongs to.Scope
Only the on-disk path was affected. Inside an archive the data track is chosen from the listing rather than by name, which is why these titles scanned correctly and only failed at conversion.
Tests
TestParseCueFileMatchesTheFilenameCaseInsensitivelyuses the real sheet's exact contents and filename. Mutation-checked: removing the fallback compiles and fails it with the user's error verbatim —references FINAL FANTASY VII DISC 1.BIN, which is missing.TestParseCueFilePrefersTheExactFilename— two files differing only in case still resolve to the one named.TestParseCueFileStillReportsAMissingTrack— a genuinely absent file is still reported, quoting the sheet's name.Also checked against the real cuesheet extracted from the archive:
FINAL FANTASY VII DISC 1.BINresolves toFinal Fantasy VII Disc 1.binand validates.Full suite,
go vet,gofmtandscripts/demo-smoke.shpass.https://claude.ai/code/session_018eBAB3V9GRxNwgpQcpGje4