From 3dbd084b3367003b82f573146cfe2d305b1a6042 Mon Sep 17 00:00:00 2001 From: Andrew Belt Date: Sun, 13 Oct 2019 21:30:43 -0400 Subject: [PATCH] Don't use glfwGetOpenedFilename() when launched via command line on Mac. --- src/main.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 6ca694a2..9ba8d019 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -161,10 +161,16 @@ int main(int argc, char* argv[]) { INFO("Initializing app"); appInit(); - const char* openedFilename = glfwGetOpenedFilename(); - if (openedFilename) { - patchPath = openedFilename; + // On Mac, use a hacked-in GLFW addition to get the launched path. +#if defined ARCH_MAC + // For some reason, launching from the command line sets glfwGetOpenedFilename(), so make sure we're running the app bundle. + if (asset::bundlePath != "") { + const char* openedFilename = glfwGetOpenedFilename(); + if (openedFilename) { + patchPath = openedFilename; + } } +#endif if (!settings::headless) { APP->patch->init(patchPath);