Chromium Code Reviews| Index: lib/src/util/io.dart |
| diff --git a/lib/src/util/io.dart b/lib/src/util/io.dart |
| index dbe34f4e01ff7965590232a7a83c39c58b672b53..fa52b370e94513a4eb07eed1e4cba66f7af826d9 100644 |
| --- a/lib/src/util/io.dart |
| +++ b/lib/src/util/io.dart |
| @@ -20,9 +20,18 @@ const _newline = 0xA; |
| /// The ASCII code for a carriage return character. |
| const _carriageReturn = 0xD; |
| +String _sdkDir; |
|
nweiz
2015/05/15 20:04:50
For lazy top-level variables, I like to take advan
kevmoo
2015/05/21 17:46:22
Done.
|
| + |
| /// The root directory of the Dart SDK. |
| -final String sdkDir = |
| - p.dirname(p.dirname(Platform.executable)); |
| +String get sdkDir { |
|
nweiz
2015/05/15 20:04:50
Add a TODO to get rid of this variable when Platfo
kevmoo
2015/05/21 17:46:22
Not sure if that's going to happen, given the curr
nweiz
2015/05/21 19:06:01
A TODO to simplify it when Platform.executable is
|
| + if (_sdkDir == null) { |
| + // This may fail on Mac if `dart` is run directly from the PATH environment |
|
nweiz
2015/05/15 20:04:50
What does "run directly from the PATH environment"
kevmoo
2015/05/21 17:46:22
Acknowledged.
|
| + // See https://code.google.com/p/dart/issues/detail?id=21791 |
|
nweiz
2015/05/15 20:04:50
What does this issue have to do with it?
kevmoo
2015/05/21 17:46:22
Acknowledged.
|
| + var path = new File(Platform.executable).resolveSymbolicLinksSync(); |
|
nweiz
2015/05/15 20:04:50
What if the bin directory is symlinked rather than
kevmoo
2015/05/21 17:46:22
This still works. resolveSymbolicLinks does the wo
|
| + _sdkDir = p.dirname(p.dirname(path)); |
| + } |
| + return _sdkDir; |
| +} |
| /// The version of the Dart SDK currently in use. |
| final Version _sdkVersion = new Version.parse( |