mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-14 00:14:18 +00:00
iOS: Return the device model name from SystemStats::getDeviceDescription() when running in the simulator
This commit is contained in:
parent
80c5f5e15e
commit
1bc7fdd1ec
1 changed files with 19 additions and 2 deletions
|
|
@ -159,11 +159,28 @@ String SystemStats::getDeviceDescription()
|
|||
#endif
|
||||
|
||||
size_t size;
|
||||
|
||||
if (sysctlbyname (name, nullptr, &size, nullptr, 0) >= 0)
|
||||
{
|
||||
HeapBlock<char> model (size);
|
||||
if (sysctlbyname (name, model, &size, nullptr, 0) >= 0)
|
||||
return model.get();
|
||||
|
||||
if (sysctlbyname (name, model, &size, nullptr, 0) >= 0)
|
||||
{
|
||||
String description (model.get());
|
||||
|
||||
#if JUCE_IOS
|
||||
if (description == "x86_64") // running in the simulator
|
||||
{
|
||||
if (auto* userInfo = [[NSProcessInfo processInfo] environment])
|
||||
{
|
||||
if (auto* simDeviceName = [userInfo objectForKey: @"SIMULATOR_DEVICE_NAME"])
|
||||
return nsStringToJuce (simDeviceName);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return description;
|
||||
}
|
||||
}
|
||||
|
||||
return {};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue