Browse Source

Platform: don't let GLFW change CWD on Apple platforms.

What a weird default.
pull/168/head
Vladimír Vondruš 3 years ago
parent
commit
66822c13fd
  1. 3
      doc/changelog.dox
  2. 9
      src/Magnum/Platform/GlfwApplication.cpp

3
doc/changelog.dox

@ -664,6 +664,9 @@ See also:
prevents computer from entering a power-saving mode while the application
is running, as that's generally undesirable for regular GUI applications.
See @ref Platform-Sdl2Application-usage-power for more information.
- @ref Platform::GlfwApplication now overrides GLFW's default behavior that
changes current working directory to `Resources/` in the app bundle on
Apple platforms.
@subsubsection changelog-latest-changes-scenegraph SceneGraph library

9
src/Magnum/Platform/GlfwApplication.cpp

@ -93,7 +93,14 @@ GlfwApplication::GlfwApplication(const Arguments& arguments, NoCreateT):
glfwSetErrorCallback([](int, const char* const description) {
Error{} << description;
});
#ifdef CORRADE_TARGET_APPLE
/* Don't change current working directory to Resources/ in the app bundle
on Apple platforms. Not sure why this would be done only on a single
platform of all, I guess it was for compatibility with SDL1 (and then
SDL2+ doesn't do this anymore but in GLFW it stays)?
https://wiki.libsdl.org/SDL2/README/macos#working-directory */
glfwInitHint(GLFW_COCOA_CHDIR_RESOURCES, false);
#endif
if(!glfwInit()) {
Error() << "Could not initialize GLFW";
std::exit(8);

Loading…
Cancel
Save