Create drive_c-mapped TMPDIR so Mono temp-file saves persist - #1801
Conversation
📝 WalkthroughWalkthroughThe Bionic and Glibc program launchers now create the Wine ChangesWine temporary directory setup
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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/components/BionicProgramLauncherComponent.java`:
- Line 254: In BionicProgramLauncherComponent.java at lines 254-254, apply all
environment updates before creating the mapped directory so it uses the final
TMPDIR value. In GlibcProgramLauncherComponent.java at lines 185-185, apply
this.envVars before creating the mapped directory. Ensure both launchers create
the Wine drive-C directory corresponding to the final guest temporary-directory
path.
- Line 254: Handle mkdirs() failure in both BionicProgramLauncherComponent and
GlibcProgramLauncherComponent by retaining each created path, verifying it with
isDirectory(), and failing launch or selecting an appropriate fallback when
creation did not produce a directory. Apply the change at
app/src/main/java/com/winlator/xenvironment/components/BionicProgramLauncherComponent.java:254
and
app/src/main/java/com/winlator/xenvironment/components/GlibcProgramLauncherComponent.java:185.
🪄 Autofix
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 Plus
Run ID: 2fe43998-5e0d-4426-b4bc-e14f2785ec80
📒 Files selected for processing (2)
app/src/main/java/com/winlator/xenvironment/components/BionicProgramLauncherComponent.javaapp/src/main/java/com/winlator/xenvironment/components/GlibcProgramLauncherComponent.java
| envVars.put("HOME", imageFs.home_path); | ||
| envVars.put("USER", ImageFs.USER); | ||
| envVars.put("TMPDIR", rootDir.getPath() + "/usr/tmp"); | ||
| new File(imageFs.home_path + "/.wine/drive_c" + rootDir.getPath() + "/usr/tmp").mkdirs(); |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win
Create the directory from the final TMPDIR value in both launchers.
Both launchers create the directory before later environment overrides can change TMPDIR. The guest can therefore use a path that has no matching Wine drive-C directory.
app/src/main/java/com/winlator/xenvironment/components/BionicProgramLauncherComponent.java#L254-L254: apply all environment updates before creating the mapped directory.app/src/main/java/com/winlator/xenvironment/components/GlibcProgramLauncherComponent.java#L185-L185: applythis.envVarsbefore creating the mapped directory.
📍 Affects 2 files
app/src/main/java/com/winlator/xenvironment/components/BionicProgramLauncherComponent.java#L254-L254(this comment)app/src/main/java/com/winlator/xenvironment/components/GlibcProgramLauncherComponent.java#L185-L185
🤖 Prompt for 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.
In
`@app/src/main/java/com/winlator/xenvironment/components/BionicProgramLauncherComponent.java`
at line 254, In BionicProgramLauncherComponent.java at lines 254-254, apply all
environment updates before creating the mapped directory so it uses the final
TMPDIR value. In GlibcProgramLauncherComponent.java at lines 185-185, apply
this.envVars before creating the mapped directory. Ensure both launchers create
the Wine drive-C directory corresponding to the final guest temporary-directory
path.
🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win
Handle directory-creation failure in both launchers.
Both launchers ignore mkdirs() failure. A missing mapped directory can preserve the lost-save failure.
app/src/main/java/com/winlator/xenvironment/components/BionicProgramLauncherComponent.java#L254-L254: verify the created path withisDirectory()and fail or use a fallback when creation fails.app/src/main/java/com/winlator/xenvironment/components/GlibcProgramLauncherComponent.java#L185-L185: verify the created path withisDirectory()and fail or use a fallback when creation fails.
📍 Affects 2 files
app/src/main/java/com/winlator/xenvironment/components/BionicProgramLauncherComponent.java#L254-L254(this comment)app/src/main/java/com/winlator/xenvironment/components/GlibcProgramLauncherComponent.java#L185-L185
🤖 Prompt for 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.
In
`@app/src/main/java/com/winlator/xenvironment/components/BionicProgramLauncherComponent.java`
at line 254, Handle mkdirs() failure in both BionicProgramLauncherComponent and
GlibcProgramLauncherComponent by retaining each created path, verifying it with
isDirectory(), and failing launch or selecting an appropriate fallback when
creation did not produce a directory. Apply the change at
app/src/main/java/com/winlator/xenvironment/components/BionicProgramLauncherComponent.java:254
and
app/src/main/java/com/winlator/xenvironment/components/GlibcProgramLauncherComponent.java:185.
There was a problem hiding this comment.
2 issues found across 2 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="app/src/main/java/com/winlator/xenvironment/components/GlibcProgramLauncherComponent.java">
<violation number="1" location="app/src/main/java/com/winlator/xenvironment/components/GlibcProgramLauncherComponent.java:185">
P2: The return value of `mkdirs()` is not checked in either launcher component. If the directory cannot be created — due to permissions, insufficient disk space, or a very deep path — the failure is completely silent. Since the entire purpose of this change is to ensure the temp directory exists under drive_c so Mono saves persist, a silent failure would directly undermine the fix with no diagnostic signal. Adding a `Log.w()` guard would help troubleshoot if this path ever fails in the field.</violation>
</file>
<file name="app/src/main/java/com/winlator/xenvironment/components/BionicProgramLauncherComponent.java">
<violation number="1" location="app/src/main/java/com/winlator/xenvironment/components/BionicProgramLauncherComponent.java:254">
P2: The same `mkdirs()` pattern for creating a TMPDIR mirror under `drive_c` is duplicated in both `BionicProgramLauncherComponent` and `GlibcProgramLauncherComponent`. Both components extend `GuestProgramLauncherComponent`, which could host a shared helper method for this directory-bootstrap step. Keeping the logic in one place avoids drift if the path, Mono behaviour, or TMPDIR value ever changes.</violation>
</file>
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
| envVars.put("HOME", imageFs.home_path); | ||
| envVars.put("USER", ImageFs.USER); | ||
| envVars.put("TMPDIR", imageFs.getRootDir().getPath() + "/tmp"); | ||
| new File(imageFs.home_path + "/.wine/drive_c" + imageFs.getRootDir().getPath() + "/tmp").mkdirs(); |
There was a problem hiding this comment.
P2: The return value of mkdirs() is not checked in either launcher component. If the directory cannot be created — due to permissions, insufficient disk space, or a very deep path — the failure is completely silent. Since the entire purpose of this change is to ensure the temp directory exists under drive_c so Mono saves persist, a silent failure would directly undermine the fix with no diagnostic signal. Adding a Log.w() guard would help troubleshoot if this path ever fails in the field.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At app/src/main/java/com/winlator/xenvironment/components/GlibcProgramLauncherComponent.java, line 185:
<comment>The return value of `mkdirs()` is not checked in either launcher component. If the directory cannot be created — due to permissions, insufficient disk space, or a very deep path — the failure is completely silent. Since the entire purpose of this change is to ensure the temp directory exists under drive_c so Mono saves persist, a silent failure would directly undermine the fix with no diagnostic signal. Adding a `Log.w()` guard would help troubleshoot if this path ever fails in the field.</comment>
<file context>
@@ -182,6 +182,7 @@ private int execGuestProgram() {
envVars.put("HOME", imageFs.home_path);
envVars.put("USER", ImageFs.USER);
envVars.put("TMPDIR", imageFs.getRootDir().getPath() + "/tmp");
+ new File(imageFs.home_path + "/.wine/drive_c" + imageFs.getRootDir().getPath() + "/tmp").mkdirs();
envVars.put("DISPLAY", ":0");
</file context>
| new File(imageFs.home_path + "/.wine/drive_c" + imageFs.getRootDir().getPath() + "/tmp").mkdirs(); | |
| File monoCacheDir = new File(imageFs.home_path + "/.wine/drive_c" + imageFs.getRootDir().getPath() + "/tmp"); | |
| if (!monoCacheDir.exists() && !monoCacheDir.mkdirs()) { | |
| Log.w("GlibcProgramLauncherComponent", "Failed to create Mono temp dir under drive_c: " + monoCacheDir); | |
| } |
| envVars.put("HOME", imageFs.home_path); | ||
| envVars.put("USER", ImageFs.USER); | ||
| envVars.put("TMPDIR", rootDir.getPath() + "/usr/tmp"); | ||
| new File(imageFs.home_path + "/.wine/drive_c" + rootDir.getPath() + "/usr/tmp").mkdirs(); |
There was a problem hiding this comment.
P2: The same mkdirs() pattern for creating a TMPDIR mirror under drive_c is duplicated in both BionicProgramLauncherComponent and GlibcProgramLauncherComponent. Both components extend GuestProgramLauncherComponent, which could host a shared helper method for this directory-bootstrap step. Keeping the logic in one place avoids drift if the path, Mono behaviour, or TMPDIR value ever changes.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At app/src/main/java/com/winlator/xenvironment/components/BionicProgramLauncherComponent.java, line 254:
<comment>The same `mkdirs()` pattern for creating a TMPDIR mirror under `drive_c` is duplicated in both `BionicProgramLauncherComponent` and `GlibcProgramLauncherComponent`. Both components extend `GuestProgramLauncherComponent`, which could host a shared helper method for this directory-bootstrap step. Keeping the logic in one place avoids drift if the path, Mono behaviour, or TMPDIR value ever changes.</comment>
<file context>
@@ -251,6 +251,7 @@ private int execGuestProgram() {
envVars.put("HOME", imageFs.home_path);
envVars.put("USER", ImageFs.USER);
envVars.put("TMPDIR", rootDir.getPath() + "/usr/tmp");
+ new File(imageFs.home_path + "/.wine/drive_c" + rootDir.getPath() + "/usr/tmp").mkdirs();
envVars.put("DISPLAY", ":0");
</file context>
Description
Signy & Mino saves were getting lost because the temp dir was being checked under C drive by mono. Create the fake temp folder under C drive so that saves persist.
Recording
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
Create a
drive_c-mapped temp directory so Mono writes temp-file saves to a persistent path. Fixes lost saves for Signy & Mino by creatingTMPDIRunder~/.wine/drive_cfor both the bionic and glibc launchers; addresses Linear issue 5a706b.Written for commit 927cfbc. Summary will update on new commits.
Summary by CodeRabbit