refactor: Moved migration to ensureImageFsSymlinks which is now called in main#1427
refactor: Moved migration to ensureImageFsSymlinks which is now called in main#1427unbelievableflavour wants to merge 1 commit into
Conversation
📝 WalkthroughWalkthroughThe PR refactors ImageFS legacy migration responsibility by simplifying the migrator API (removing wineVersion dependency and symlink setup), introducing a new symlink-setup method in ImageFsInstaller, and updating app initialization to use the new method. Tests are updated to match the new behavior. ChangesImageFS Migration Refactoring
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@app/src/main/java/com/winlator/xenvironment/ImageFsInstaller.java`:
- Around line 519-531: ensureImageFsSymlinks currently ignores failures from
symlink setup; change ensureSharedHomeRoot(...) and
ensureProtonVersionSymlink(...) to return boolean indicating success and update
ensureImageFsSymlinks to check those return values (call
ensureSharedHomeRoot(context, legacyImageFsRoot) and if it returns false then
return false; if Container.BIONIC.equals(variant) then call
ensureProtonVersionSymlink(context, legacyImageFsRoot, wineVersion) and if it
returns false then return false) so any symlink creation failure propagates and
causes ensureImageFsSymlinks to return false.
In `@app/src/test/java/com/winlator/xenvironment/ImageFsInstallerTest.kt`:
- Around line 34-36: The teardown currently calls imageFsLink.delete() which
will fail if imageFsLink is a non-symlink directory with contents; update the
cleanup in ImageFsInstallerTest so that when
Files.isSymbolicLink(imageFsLink.toPath()) is false and imageFsLink.exists() is
true you perform a recursive delete of the directory contents (e.g., via
java.nio.file.Files.walkFileTree or a library helper like
org.apache.commons.io.FileUtils.deleteDirectory) instead of a single-file
delete, while leaving the symlink branch to just delete the link.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: c254efa6-8b25-4993-9529-6a2609b45356
📒 Files selected for processing (5)
app/src/main/java/app/gamenative/ui/PluviaMain.ktapp/src/main/java/com/winlator/xenvironment/ImageFSLegacyMigrator.javaapp/src/main/java/com/winlator/xenvironment/ImageFsInstaller.javaapp/src/test/java/com/winlator/xenvironment/ImageFSLegacyMigratorTest.ktapp/src/test/java/com/winlator/xenvironment/ImageFsInstallerTest.kt
Description
Title says it all. This PR is simply to make the imagefs PR smaller again. Some final pre-work that can be merged before-hand.
Recording
Not necessary.
Type of Change
Checklist
#code-changes, I have discussed this change there and it has been green-lighted. If I do not have access, I have still provided clear context in this PR. If I skip both, I accept that this change may face delays in review, may not be reviewed at all, or may be closed.CONTRIBUTING.md.Summary by cubic
Centralized ImageFS legacy migration and symlink setup into
ImageFsInstaller.ensureImageFsSymlinks, now called during app pre-launch for more reliable shared home and Proton links.ImageFsInstaller.ensureImageFsSymlinks(context, legacyRoot, container)to run migration, then ensure shared home and Proton (only forContainer.BIONIC).ImageFSLegacyMigrator.migrateLegacyDirsIfNeeded(context, legacyRoot)migration-only (removedwineVersionparam and symlink responsibilities).PluviaMain.preLaunchAppto callensureImageFsSymlinks; updated failure log message.ensureImageFsSymlinksfailure path.Written for commit dfdf8dc. Summary will update on new commits.
Summary by CodeRabbit
Bug Fixes
Refactor