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

Commit 3834076

Browse files
Update cli_util.dart
1 parent 8726cd3 commit 3834076

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

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'.

0 commit comments

Comments
 (0)