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

Commit

Permalink
Merge pull request #12 from dart-lang/stereotype441-patch-1
Browse files Browse the repository at this point in the history
Find SDK properly when invoked from inside SDK tests.
  • Loading branch information
stereotype441 authored Sep 26, 2016
2 parents 8726cd3 + 8e33314 commit 1161b13
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 0.0.1+3

- Find SDK properly when invoked from inside SDK tests.

## 0.0.1+2

- Support an executable in a symlinked directory.
Expand Down
9 changes: 8 additions & 1 deletion lib/cli_util.dart
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,14 @@ Directory getSdkDir([List<String> cliArgs]) {
}

// Look relative to the dart executable.
Directory sdkDirectory = new File(Platform.executable).parent.parent;
File platformExecutable = new File(Platform.executable);
Directory sdkDirectory = platformExecutable.parent.parent;
if (_isSdkDir(sdkDirectory)) return sdkDirectory;

// Handle the case where Platform.executable is a sibling of the SDK directory
// (this happens during internal testing).
sdkDirectory =
new Directory(p.join(platformExecutable.parent.path, 'dart-sdk'));
if (_isSdkDir(sdkDirectory)) return sdkDirectory;

// Try and locate the VM using 'which'.
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: cli_util
version: 0.0.1+2
version: 0.0.1+3
author: Dart Team <[email protected]>
description: A library to help in building Dart command-line apps.
homepage: https://github.com/dart-lang/cli_util
Expand Down

0 comments on commit 1161b13

Please sign in to comment.