Skip to content
This repository was archived by the owner on Nov 1, 2024. It is now read-only.

Commit 1161b13

Browse files
Merge pull request #12 from dart-lang/stereotype441-patch-1
Find SDK properly when invoked from inside SDK tests.
2 parents 8726cd3 + 8e33314 commit 1161b13

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
## 0.0.1+3
4+
5+
- Find SDK properly when invoked from inside SDK tests.
6+
37
## 0.0.1+2
48

59
- Support an executable in a symlinked directory.

lib/cli_util.dart

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,14 @@ Directory getSdkDir([List<String> cliArgs]) {
3333
}
3434

3535
// Look relative to the dart executable.
36-
Directory sdkDirectory = new File(Platform.executable).parent.parent;
36+
File platformExecutable = new File(Platform.executable);
37+
Directory sdkDirectory = platformExecutable.parent.parent;
38+
if (_isSdkDir(sdkDirectory)) return sdkDirectory;
39+
40+
// Handle the case where Platform.executable is a sibling of the SDK directory
41+
// (this happens during internal testing).
42+
sdkDirectory =
43+
new Directory(p.join(platformExecutable.parent.path, 'dart-sdk'));
3744
if (_isSdkDir(sdkDirectory)) return sdkDirectory;
3845

3946
// Try and locate the VM using 'which'.

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: cli_util
2-
version: 0.0.1+2
2+
version: 0.0.1+3
33
author: Dart Team <[email protected]>
44
description: A library to help in building Dart command-line apps.
55
homepage: https://github.com/dart-lang/cli_util

0 commit comments

Comments
 (0)