Skip to content

fix(setup): stage FEX scripts and tools when MetalSharp Wine was downloaded - #774

Merged
aaf2tbz merged 1 commit into
metalsharp:mainfrom
bondarev:fix/fex-downloaded-runtime-resources
Nov 13, 2026
Merged

aaf2tbz merged 1 commit into
metalsharp:mainfrom
bondarev:fix/fex-downloaded-runtime-resources

Conversation

@bondarev

Copy link
Copy Markdown
Contributor

Switching the regular 1.1.0 app (MetalSharp-1.1.0-arm64.dmg) to FEX with the FEX | x86_64 toggle fails setup at step 10:

Scripts/tools bundle is missing or incomplete
Error: missing or invalid metalsharp-scripts-tools.tar.zst

The regular app does not carry MetalSharp-Wine.app, so ms_wine_runtime_download puts it in ~/.metalsharp/downloads/, and app_source() returns that path. fex_stage_scripts_tools() in setup.c strips the app name and expects configs and scripts/tools/{native,updater} in the same folder, which is only true when the app sits in MetalSharp.app/Contents/Resources. In downloads/ they are missing, so staging fails. The error text points at the scripts-tools archive, but the FEX path never reads it.

ms_mtsp_open_rules_file() in mtsp.c has the same assumption for its Resources fallback. It's hidden there because the staged ~/.metalsharp/configs copy is found first.

Changes:

  • ms_app_resources_path(name) in wine_runtime.c: the Resources lookup split out of app_source() (next to the backend, then /Applications/MetalSharp.app), without the downloads/ fallback. $METALSHARP_APP_RESOURCES overrides it for tests.
  • app_source() uses it and keeps the downloads/ fallback, so ms_wine_fex_app_source() behaves as before.
  • fex_stage_scripts_tools() and the rules fallback in mtsp.c take Resources from ms_app_resources_path() instead of the Wine app's parent.
  • wine_runtime_test.c: with the Wine app only in downloads/, ms_wine_fex_app_source() returns the download and ms_app_resources_path("configs") returns Resources.

Tested:

  • make -C app/src-c test passes for both the regular and fex variants.
  • Ran POST /setup/install-all on a scratch METALSHARP_HOME, with METALSHARP_ACTIVE_RUNTIME=fex, the bundled tool paths from the regular 1.1.0 app, and MetalSharp-Wine.app only in downloads/. The 1.1.0 backend from /Applications/MetalSharp.app fails at step 10 with the error above. The backend from this branch stages scripts/tools/{cef,configs,native,updater} and gets to step 18 (Steam prefix). I stopped it there. macOS 27.2, M4 Max.

Workaround on 1.1.0: copy configs and scripts/tools/{native,updater} from /Applications/MetalSharp.app/Contents/Resources into ~/.metalsharp/downloads/, then run setup again. With that in place, setup completed all 18 steps on my install.

…loaded

Switching a regular MetalSharp.app to the FEX runtime downloads
MetalSharp-Wine.app into ~/.metalsharp/downloads/. Setup then looked for
configs and scripts/tools beside that app, assuming it sits in
MetalSharp.app's Resources, so step 10 failed with "missing or invalid
metalsharp-scripts-tools.tar.zst", an archive the FEX path never reads.
The FEX rule-set fallback in mtsp.c made the same assumption.

Resolve both through ms_app_resources_path(), which looks only in
MetalSharp.app's Resources, and keep the downloads/ fallback to
ms_wine_fex_app_source().
@bondarev
bondarev requested a review from aaf2tbz as a code owner November 11, 2026 18:39
@aaf2tbz

aaf2tbz commented Nov 13, 2026

Copy link
Copy Markdown
Collaborator

Thank you for this fix!

@aaf2tbz
aaf2tbz merged commit f23d7bf into metalsharp:main Nov 13, 2026
7 checks passed
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.

2 participants