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
Ebitengine changes working directory when you have resources? #2919
Comments
Could you write the result? What are the results in |
I couldn't reproduce the issue
|
Thanks for looking into it -- indeed,
works fine for me as well. My test app is named "res" and I hit the issue when I do
I simplified the test app above, but without the the ebiten import included my output is
and with it included my output is
Been poking at the source -- I see |
I failed to reproduce this even with
This logic should be intentional, though this should not happen when the binary is not in a .app directory. I was wondering why this happens in your environment.
ebiten/internal/glfw/init_unix.c Line 296 in 34cdb20
|
Thanks much for the help, unfortunately I don't know anything about macOS dev but after reading up on bundles, so far one thing has caught my eye:
That has certainly been my experience. As long as there is an executable and a Resources folder present (actually I've been using "resources"; I thought macOS was case sensitive but in this case it seems to be ignored) then the parent is identified as a bundle. The go run . command does not return a main bundle with a Resources folder because it is compiled and run from a temp directory without a resources folder. Of course, none of that explains why you (and presumably everyone else) is not having this issue occur. But based on my reading of the docs, what is happening on my system seems reasonable. Unfortunately I don't see any details around what "creates a bundle whenever it possibly can." All I can find are the rules around bundles, which would seem to exclude my case, and that one line, which is broadly inclusive but not specific enough for me to say I'm seeing what should be correct behavior. I have another Mac I might try this on, otherwise I can't think of anything to do but try to find more info around how CFBundleGetMainBundle() is working. |
Ebitengine Version
v2.6.6
Operating System
Go Version (
go version
)1.21.4
What steps will reproduce the problem?
Given this app and a resources/ folder at the same level as main.go:
The printed working directory is to my executable.
If you import ebitengine and run, I.e.:
Now the printed working directory is to the executable/resources.
If you renamed your local resources/ dir to something else (like resources2/) and rerun, now the working directory is back to the executable.
What is the expected result?
The working directory is always the path to my executable's parent regardless of whether ebitengine is imported.
What happens instead?
With ebitengine imported the working directory is now the path to my parent + /resources.
Anything else you feel useful to add?
No response
The text was updated successfully, but these errors were encountered: