From 8f7d9f7522a21becf698b5da484bf3c878424908 Mon Sep 17 00:00:00 2001 From: jules Date: Thu, 11 Aug 2016 09:26:56 +0100 Subject: [PATCH] Workaround to avoid an assertion when using File::invokedExecutableFile from a command-line invoked app on OSX --- modules/juce_core/native/juce_mac_Files.mm | 8 ++++---- modules/juce_core/system/juce_SystemStats.cpp | 10 ++++------ 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/modules/juce_core/native/juce_mac_Files.mm b/modules/juce_core/native/juce_mac_Files.mm index 564ccc7ec0..35d8629fcc 100644 --- a/modules/juce_core/native/juce_mac_Files.mm +++ b/modules/juce_core/native/juce_mac_Files.mm @@ -218,7 +218,7 @@ File File::getSpecialLocation (const SpecialLocationType type) case invokedExecutableFile: if (juce_argv != nullptr && juce_argc > 0) - return File (CharPointer_UTF8 (juce_argv[0])); + return File::getCurrentWorkingDirectory().getChildFile (CharPointer_UTF8 (juce_argv[0])); // deliberate fall-through... case currentExecutableFile: @@ -229,13 +229,13 @@ File File::getSpecialLocation (const SpecialLocationType type) const File exe (juce_getExecutableFile()); const File parent (exe.getParentDirectory()); - #if JUCE_IOS + #if JUCE_IOS return parent; - #else + #else return parent.getFullPathName().endsWithIgnoreCase ("Contents/MacOS") ? parent.getParentDirectory().getParentDirectory() : exe; - #endif + #endif } case hostApplicationPath: diff --git a/modules/juce_core/system/juce_SystemStats.cpp b/modules/juce_core/system/juce_SystemStats.cpp index 9edbb16562..a451b386b0 100644 --- a/modules/juce_core/system/juce_SystemStats.cpp +++ b/modules/juce_core/system/juce_SystemStats.cpp @@ -198,11 +198,9 @@ bool SystemStats::isRunningInAppExtensionSandbox() noexcept bundle = bundle.getParentDirectory().getParentDirectory(); #endif - if (! bundle.isDirectory()) - return false; - - return (bundle.getFileExtension() == ".appex"); - #else - return false; + if (bundle.isDirectory()) + return (bundle.getFileExtension() == ".appex"); #endif + + return false; }