dart-sdk/runtime/bin/platform_macos_cocoa.mm
Brian Quinlan 8462f1da74 Fix a bug where Platform.operatingSystemVersion was incorrect in the iOS
simulator.

Also changes the MacOS implementation of that property.

TEST=platform_os_version_test.dart

Bug: 47138
Change-Id: I9134845a216423c8a383b804986af1ebb3c8d3d9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/214863
Commit-Queue: Brian Quinlan <bquinlan@google.com>
Reviewed-by: Chinmay Garde <chinmaygarde@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2021-10-19 21:25:43 +00:00

29 lines
854 B
Text

// Copyright (c) 2021, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
#include "platform/globals.h"
#if !defined(DART_HOST_OS_MACOS)
#error Do not build platform_macos_cocoa.mm on non-MacOS platforms.
#endif
#include "bin/platform_macos_cocoa.h"
#import <Foundation/NSProcessInfo.h>
#import <Foundation/NSString.h>
namespace dart {
namespace bin {
std::string NSProcessInfoOperatingSystemVersionString() {
@autoreleasepool {
// `operatingSystemVersionString` has been available since iOS 2.0+ and macOS 10.2+.
NSString* version =
[[NSProcessInfo processInfo] operatingSystemVersionString];
return std::string([version UTF8String]);
}
}
} // namespace bin
} // namespace dart