Skip to content

Create drive_c-mapped TMPDIR so Mono temp-file saves persist - #1801

Merged
utkarshdalal merged 1 commit into
masterfrom
game-cloud-saves-issue-5a706b
Aug 9, 2026
Merged

Create drive_c-mapped TMPDIR so Mono temp-file saves persist#1801
utkarshdalal merged 1 commit into
masterfrom
game-cloud-saves-issue-5a706b

Conversation

@utkarshdalal

@utkarshdalal utkarshdalal commented Aug 9, 2026

Copy link
Copy Markdown
Owner

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

  • Bug fix
  • Performance / stability improvement
  • Compatibility improvements
  • Other (requires prior approval)

Checklist

  • If I have access to #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.
  • This change aligns with the current project scope (core functionality, stability, or performance). If not, it has been explicitly approved beforehand.
  • I have attached a recording of the change.
  • I have read and agree to the contribution guidelines in 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 creating TMPDIR under ~/.wine/drive_c for both the bionic and glibc launchers; addresses Linear issue 5a706b.

Written for commit 927cfbc. Summary will update on new commits.

Review in cubic

Summary by CodeRabbit

  • Bug Fixes
    • Improved guest program launching by ensuring required Wine temporary directories are created automatically.
    • Increased launch reliability when configured temporary paths or Wine environments are missing their expected directories.

@coderabbitai

coderabbitai Bot commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The Bionic and Glibc program launchers now create the Wine drive_c temporary directory before launching guest programs.

Changes

Wine temporary directory setup

Layer / File(s) Summary
Create Wine temporary directories
app/src/main/java/com/winlator/xenvironment/components/BionicProgramLauncherComponent.java, app/src/main/java/com/winlator/xenvironment/components/GlibcProgramLauncherComponent.java
Both launchers create the configured temporary-directory path under Wine drive_c before guest execution.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

  • utkarshdalal/GameNative#203: Modifies BionicProgramLauncherComponent.execGuestProgram for different execution-environment setup behavior.

Suggested reviewers: catpotatos

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the main change: creating a drive_c-mapped TMPDIR so Mono temporary saves persist.
Description check ✅ Passed The description includes all required sections and explains the bug and fix, but it does not include a recording and leaves the scope checklist item unchecked.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch game-cloud-saves-issue-5a706b

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between bd1c439 and 927cfbc.

📒 Files selected for processing (2)
  • app/src/main/java/com/winlator/xenvironment/components/BionicProgramLauncherComponent.java
  • app/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();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🗄️ 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: apply this.envVars before 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 with isDirectory() 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 with isDirectory() 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.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>
Suggested change
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();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>

@utkarshdalal
utkarshdalal merged commit 556a1e6 into master Aug 9, 2026
2 of 3 checks passed
@utkarshdalal
utkarshdalal deleted the game-cloud-saves-issue-5a706b branch August 9, 2026 10:41
intercontinentalmassacre added a commit to intercontinentalmassacre/Gameplay that referenced this pull request Aug 10, 2026
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