diff --git a/CHANGELOG.md b/CHANGELOG.md index 2a2d63c..7271432 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/lib/cli_util.dart b/lib/cli_util.dart index a997c43..683bef7 100644 --- a/lib/cli_util.dart +++ b/lib/cli_util.dart @@ -38,15 +38,17 @@ Directory getSdkDir([List 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; } diff --git a/pubspec.yaml b/pubspec.yaml index 0beb6cc..80f21e1 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,5 +1,5 @@ name: cli_util -version: 0.0.1 +version: 0.0.1+1 author: Dart Team description: A library to help in building Dart command-line apps. homepage: https://github.com/dart-lang/cli_util