mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-17 00:44:19 +00:00
Cache the result of isRunningInAppExtensionSandbox
This commit is contained in:
parent
495e2bfd56
commit
bf85f4c68b
1 changed files with 18 additions and 8 deletions
|
|
@ -191,16 +191,26 @@ void SystemStats::setApplicationCrashHandler (CrashHandlerFunction handler)
|
|||
|
||||
bool SystemStats::isRunningInAppExtensionSandbox() noexcept
|
||||
{
|
||||
#if JUCE_MAC || JUCE_IOS
|
||||
File bundle = File::getSpecialLocation (File::invokedExecutableFile).getParentDirectory();
|
||||
#if JUCE_MAC || JUCE_IOS
|
||||
static bool firstQuery = true;
|
||||
static bool isRunningInAppSandbox = false;
|
||||
|
||||
#if JUCE_MAC
|
||||
bundle = bundle.getParentDirectory().getParentDirectory();
|
||||
#endif
|
||||
if (firstQuery)
|
||||
{
|
||||
firstQuery = false;
|
||||
|
||||
if (bundle.isDirectory())
|
||||
return (bundle.getFileExtension() == ".appex");
|
||||
#endif
|
||||
File bundle = File::getSpecialLocation (File::invokedExecutableFile).getParentDirectory();
|
||||
|
||||
#if JUCE_MAC
|
||||
bundle = bundle.getParentDirectory().getParentDirectory();
|
||||
#endif
|
||||
|
||||
if (bundle.isDirectory())
|
||||
isRunningInAppSandbox = (bundle.getFileExtension() == ".appex");
|
||||
}
|
||||
|
||||
return isRunningInAppSandbox;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue