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

Commit 1bcc7a0

Browse files
committed
Support an executable in a symlinked directory.
[email protected] Review URL: https://chromiumcodereview.appspot.com//1132913003
1 parent d180f7a commit 1bcc7a0

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
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+2
4+
5+
- Support an executable in a symlinked directory.
6+
37
## 0.0.1+1
48

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

lib/cli_util.dart

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ library cli_util;
66

77
import 'dart:io';
88

9+
import 'package:path/path.dart' as p;
910
import 'package:which/which.dart';
1011

1112
/// Return the path to the current Dart SDK. This will return `null` if we are
@@ -45,6 +46,12 @@ Directory getSdkDir([List<String> cliArgs]) {
4546
executable = link.resolveSymbolicLinksSync();
4647
}
4748

49+
Link parentLink = new Link(p.dirname(executable));
50+
if (parentLink.existsSync()) {
51+
executable = p.join(
52+
parentLink.resolveSymbolicLinksSync(), p.basename(executable));
53+
}
54+
4855
File dartVm = new File(executable);
4956
Directory dir = dartVm.parent.parent;
5057
if (_isSdkDir(dir)) return dir;

pubspec.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
name: cli_util
2-
version: 0.0.1+1
2+
version: 0.0.1+2
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
66
environment:
77
sdk: '>=1.0.0 <2.0.0'
88
dependencies:
9+
path: '>=1.0.0 <2.0.0'
910
which: '>=0.1.2 <0.2.0'
1011
dev_dependencies:
1112
unittest: '>=0.11.0 <0.12.0'

0 commit comments

Comments
 (0)