dart-sdk/runtime/bin/platform_macos.h
Zichang Guo b8a6e77700 Update operatingSystemVersion on MacOS/iOS to return system version instead of kernel version
Platform.operatingSystemVersion on MacOS/iOS returns the version of the
kernel. It should instead returns system version.

This cl will try to use recently added "kern.osproductversion" to get
the system version. If it failed, try to read from "SystemVersion.plist".
Falls back to original kernal version if none of them succeed.

Bug: https://github.com/dart-lang/sdk/issues/41725
Change-Id: Ibbf78f10dc6d21b79d83d82fbcdacfd22ebc716d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/151165
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Zichang Guo <zichangguo@google.com>
2020-07-07 21:07:55 +00:00

28 lines
860 B
C++

// Copyright (c) 2020, 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.
#ifndef RUNTIME_BIN_PLATFORM_MACOS_H_
#define RUNTIME_BIN_PLATFORM_MACOS_H_
#if !defined(RUNTIME_BIN_PLATFORM_H_)
#error Do not include platform_macos.h directly;
#error use platform.h instead.
#endif
namespace dart {
namespace bin {
// This function extracts OSVersion from SystemVersion.plist.
// The format of input should be:
// <key>ProductVersion</key>
// <string>10.15.4</string>
// Returns the string representation of OSVersion. For example, "10.15.4" will
// be returned in the previous example.
char* ExtractsOSVersionFromString(char* str);
} // namespace bin
} // namespace dart
#endif // RUNTIME_BIN_PLATFORM_MACOS_H_