Skip to content

Move the fix into resolveCaseInsensitive#20

Open
utkarshdalal wants to merge 2 commits into
phobos665:fix/epic-saves-disco-elysium-fixfrom
utkarshdalal:fix/case-insensitive-resolve-resume
Open

Move the fix into resolveCaseInsensitive#20
utkarshdalal wants to merge 2 commits into
phobos665:fix/epic-saves-disco-elysium-fixfrom
utkarshdalal:fix/case-insensitive-resolve-resume

Conversation

@utkarshdalal

Copy link
Copy Markdown

This builds on your PR but moves the actual fix to where the bug is: FileUtils.resolveCaseInsensitive.

The root cause isn't Epic-specific. resolveCaseInsensitive gave up case-insensitive matching for the entire rest of the path the moment listFiles() returned null:

} else {
    // append remaining segments verbatim
    for (j in i until segments.size) current = File(current, segments[j])
    return current
}

On-device the app can't list /, /data, /data/user, etc. (they return null), so anchored at File("/") the walk bailed on the very first segment and appended everything — including locallow — verbatim, never reaching AppData/. 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 matches LocalLow.

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 resolveAbsolutePathCaseInsensitive is no longer needed.

I kept canonicalizeAppDataSegments since it's still useful for getting the casing right when creating a save dir that doesn't exist yet.

Tests: replaced the resolveAbsolutePathCaseInsensitive test with one that exercises the real resolveCaseInsensitive(File("/"), ...) path, plus a regression test that an unmatched/unlistable intermediate segment no longer aborts matching beneath it. :app:testModernDebugUnitTest passes.

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.
@utkarshdalal

Copy link
Copy Markdown
Author

I made a PR to your branch that puts the change into CaseInsensitiveFileSystem - can you check and try it?

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.

1 participant