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

Null link fix #4

Merged
merged 4 commits into from
Feb 10, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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+1

- Fix for when the dart executable can't be found by `which`.

## 0.0.1

- Initial version
18 changes: 10 additions & 8 deletions lib/cli_util.dart
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,17 @@ Directory getSdkDir([List<String> cliArgs]) {
// Try and locate the VM using 'which'.
String executable = whichSync('dart', orElse: () => null);

// In case Dart is symlinked (e.g. homebrew on Mac) follow symbolic links.
Link link = new Link(executable);
if (link.existsSync()) {
executable = link.resolveSymbolicLinksSync();
}
if (executable != null) {
// In case Dart is symlinked (e.g. homebrew on Mac) follow symbolic links.
Link link = new Link(executable);
if (link.existsSync()) {
executable = link.resolveSymbolicLinksSync();
}

File dartVm = new File(executable);
Directory dir = dartVm.parent.parent;
if (_isSdkDir(dir)) return dir;
File dartVm = new File(executable);
Directory dir = dartVm.parent.parent;
if (_isSdkDir(dir)) return dir;
}

return null;
}
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
version: 0.0.1+1
author: Dart Team <misc@dartlang.org>
description: A library to help in building Dart command-line apps.
homepage: https://github.com/dart-lang/cli_util
Expand Down