Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 library code_transformers.src.dart_sdk; | 5 library code_transformers.src.dart_sdk; |
| 6 | 6 |
| 7 import 'dart:convert' as convert; | 7 import 'dart:convert' as convert; |
| 8 import 'dart:io' show Directory, File, Platform, Process; | 8 import 'dart:io' show Directory, File, Platform, Process; |
| 9 import 'package:path/path.dart' as path; | 9 import 'package:path/path.dart' as path; |
| 10 | 10 |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 40 | 40 |
| 41 var parts = path.split(dartDir); | 41 var parts = path.split(dartDir); |
| 42 // If the dart executable is within the sdk dir then get the root. | 42 // If the dart executable is within the sdk dir then get the root. |
| 43 if (parts.contains('dart-sdk')) { | 43 if (parts.contains('dart-sdk')) { |
| 44 var dartSdkDir = path.joinAll(parts.take(parts.indexOf('dart-sdk') + 1)); | 44 var dartSdkDir = path.joinAll(parts.take(parts.indexOf('dart-sdk') + 1)); |
| 45 if (isSdkDir(dartSdkDir)) return dartSdkDir; | 45 if (isSdkDir(dartSdkDir)) return dartSdkDir; |
| 46 } | 46 } |
| 47 | 47 |
| 48 return null; | 48 return null; |
| 49 } | 49 } |
| 50 | |
| 51 /// Variant of [dartSdkDirectory] which includes additional cases only | |
| 52 /// typically encountered in Dart's testing environment. | |
| 53 String get testingDartSdkDirectory { | |
|
Siggi Cherem (dart-lang)
2014/03/14 21:31:43
i just copied this from your CL, but I don't plan
| |
| 54 var sdkDir = dartSdkDirectory; | |
| 55 if (sdkDir == null) { | |
| 56 // If we cannot find the SDK dir, then assume this is being run from Dart's | |
| 57 // source directory and this script is the main script. | |
| 58 sdkDir = path.join( | |
| 59 path.dirname(path.fromUri(Platform.script)), '..', '..', '..', 'sdk'); | |
| 60 } | |
| 61 return sdkDir; | |
| 62 } | |
| OLD | NEW |