Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(928)

Unified Diff: sdk/lib/io/platform_impl.dart

Issue 3006873002: [dart:io] Adds Platform.operatingSystemVersion (Closed)
Patch Set: Updated CHANGELOG Created 3 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sdk/lib/io/platform.dart ('k') | tests/standalone/io/platform_os_version_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/io/platform_impl.dart
diff --git a/sdk/lib/io/platform_impl.dart b/sdk/lib/io/platform_impl.dart
index 2eddc6da20cd883d0817bc22d808879ac339851b..df25981c9e74b1624c163baee07c3d616a39f9e1 100644
--- a/sdk/lib/io/platform_impl.dart
+++ b/sdk/lib/io/platform_impl.dart
@@ -8,6 +8,7 @@ class _Platform {
external static int _numberOfProcessors();
external static String _pathSeparator();
external static String _operatingSystem();
+ external static _operatingSystemVersion();
external static _localHostname();
external static _executable();
external static _resolvedExecutable();
@@ -61,13 +62,24 @@ class _Platform {
static String get operatingSystem => _operatingSystem();
static Uri get script => _script();
+ static String _cachedOSVersion;
+ static String get operatingSystemVersion {
+ if (_cachedOSVersion == null) {
+ var result = _operatingSystemVersion();
+ if (result is OSError) {
+ throw result;
+ }
+ _cachedOSVersion = result;
+ }
+ return _cachedOSVersion;
+ }
+
static String get localHostname {
var result = _localHostname();
if (result is OSError) {
throw result;
- } else {
- return result;
}
+ return result;
}
static List<String> get executableArguments => _executableArguments();
« no previous file with comments | « sdk/lib/io/platform.dart ('k') | tests/standalone/io/platform_os_version_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698