diff --git a/src/love.cpp b/src/love.cpp index 414472eda..5dbc9b134 100644 --- a/src/love.cpp +++ b/src/love.cpp @@ -75,38 +75,39 @@ static void get_app_arguments(int argc, char **argv, int &new_argc, char **&new_ temp_argv.push_back(std::string(argv[i])); } -#ifdef LOVE_MACOSX - // Check for a drop file string, if the app wasn't launched in a terminal. - // Checking for the terminal is a pretty big hack, but works around an issue - // where OS X will switch Spaces if the terminal launching love is in its - // own full-screen Space. - std::string dropfilestr; - if (!isatty(STDIN_FILENO)) - dropfilestr = love::macosx::checkDropEvents(); - - if (!dropfilestr.empty()) - temp_argv.insert(temp_argv.begin() + 1, dropfilestr); - else -#endif - { - // If it exists, add the love file in love.app/Contents/Resources/ to argv. - std::string loveResourcesPath; - bool fused = true; + // If it exists, add the love file in love.app/Contents/Resources/ to argv. + std::string loveResourcesPath; + bool fused = true; #if defined(LOVE_MACOSX) - loveResourcesPath = love::macosx::getLoveInResources(); + loveResourcesPath = love::macosx::getLoveInResources(); #elif defined(LOVE_IOS) - loveResourcesPath = love::ios::getLoveInResources(fused); + loveResourcesPath = love::ios::getLoveInResources(fused); #endif - if (!loveResourcesPath.empty()) - { - std::vector::iterator it = temp_argv.begin(); - it = temp_argv.insert(it + 1, loveResourcesPath); + if (!loveResourcesPath.empty()) + { + std::vector::iterator it = temp_argv.begin(); + it = temp_argv.insert(it + 1, loveResourcesPath); - // Run in pseudo-fused mode. - if (fused) - temp_argv.insert(it + 1, std::string("--fused")); + // Run in pseudo-fused mode. + if (fused) + temp_argv.insert(it + 1, std::string("--fused")); + } +#ifdef LOVE_MACOSX + else + { + // Check for a drop file string, if the app wasn't launched in a + // terminal. Checking for the terminal is a pretty big hack, but works + // around an issue where OS X will switch Spaces if the terminal + // launching love is in its own full-screen Space. + if (!isatty(STDIN_FILENO)) + { + // Static to keep the same value after love.event.equit("restart"). + static std::string dropfilestr = love::macosx::checkDropEvents(); + if (!dropfilestr.empty()) + temp_argv.insert(temp_argv.begin() + 1, dropfilestr); } } +#endif // Copy temp argv vector to new argv array. new_argc = (int) temp_argv.size();