8000 Gum looks in wrong location for content in macOS app bundles · Issue #731 · vchelaru/Gum · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Gum looks in wrong location for content in macOS app bundles #731

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
AristurtleDev opened this issue May 6, 2025 · 1 comment
Open

Comments

@AristurtleDev
Copy link
Contributor
AristurtleDev commented May 6, 2025

When building an application for macOS, you typically will create a .app Application Bundle. These macOS applications follow a very specific directory structure:

YourGame.app/
├── Contents/
│   ├── Info.plist
│   ├── MacOS/
│   │   └── YourGame
│   └── Resources/
│       ├── Content/
│       └── YourGame.icns
  1. The main game executable is at YourGame.app/Contents/MacOS/YourGame
  2. The content files that are created by the content pipeline are in YourGame.app/Contents/Resources/Content

When attempting to do something like using a custom font with a command such as this

textInstance.CustomFontFile = "fonts/04b_30.fnt";

Gum will look for that file path relative to the executable.

On Windows and Linux, this works fine since the Contents directory is relative to the executable, but for a macOS application bundle, the Content directory is not relative to the executable. Instead, from the executable it is ../Resources/Content.

MonoGame handles this in the TitleContainer automatically here by using a location value callled NSBundle.MainBundle.ResourcePath

https://github.com/MonoGame/MonoGame/blob/8ef655d5ca2c74e255aba2d93ea3a66a34ce6b07/MonoGame.Framework/Platform/TitleContainer.MacOS.cs#L20

This issue can be worked around by just simply placing the needed content files inside the MacOS/ directory relative to the executable. There is no rule against doing this, but it is not the common practice or the recommended setup for application bundles.

@kaltinril
Copy link
Collaborator

There goes MAC, always gotta be different and difficult :p

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

No branches or pull requests

2 participants
0