Move the fix into resolveCaseInsensitive#20
Open
utkarshdalal wants to merge 2 commits into
Open
Conversation
resolveCaseInsensitive() gave up case-insensitive matching for the rest
of the path the moment listFiles() returned null (unreadable dirs like
/data on Android, or not-yet-created dirs). Anchored at File("/"), the
walk bailed on the first segment and appended everything verbatim,
including lowercase AppData subfolders like locallow, so Epic cloud saves
never matched the on-disk LocalLow.
Descend with the literal segment instead of bailing, resuming matching at
any level we can read. This fixes the Disco Elysium save detection at the
shared helper, so GOG saves benefit too, and removes the Epic-specific
resolveAbsolutePathCaseInsensitive workaround.
Author
|
I made a PR to your branch that puts the change into CaseInsensitiveFileSystem - can you check and try it? |
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.
This builds on your PR but moves the actual fix to where the bug is:
FileUtils.resolveCaseInsensitive.The root cause isn't Epic-specific.
resolveCaseInsensitivegave up case-insensitive matching for the entire rest of the path the momentlistFiles()returnednull:On-device the app can't list
/,/data,/data/user, etc. (they returnnull), so anchored atFile("/")the walk bailed on the very first segment and appended everything — includinglocallow— verbatim, never reachingAppData/. That's why it passed your unit tests but failed on a real device: on a dev box you can list from/, so the walk descends all the way down and matchesLocalLow.Fix is to descend with the literal segment and keep going instead of bailing, resuming case-insensitive matching at any level we can actually read. With that, the original one-liner works as-is, GOG saves get the same robustness for free, and
resolveAbsolutePathCaseInsensitiveis no longer needed.I kept
canonicalizeAppDataSegmentssince it's still useful for getting the casing right when creating a save dir that doesn't exist yet.Tests: replaced the
resolveAbsolutePathCaseInsensitivetest with one that exercises the realresolveCaseInsensitive(File("/"), ...)path, plus a regression test that an unmatched/unlistable intermediate segment no longer aborts matching beneath it.:app:testModernDebugUnitTestpasses.