Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(11)

Unified Diff: lib/cli_util.dart

Issue 1132913003: Support an executable in a symlinked directory. (Closed) Base URL: git@github.com:dart-lang/cli_util@master
Patch Set: Remove a debugging print. Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « CHANGELOG.md ('k') | pubspec.yaml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/cli_util.dart
diff --git a/lib/cli_util.dart b/lib/cli_util.dart
index 683bef7e2629ff0355df01c55f1b4acadcd13d0f..aff2c6799978a1445c485fdc512e0ae9fdfe69e4 100644
--- a/lib/cli_util.dart
+++ b/lib/cli_util.dart
@@ -6,6 +6,7 @@ library cli_util;
import 'dart:io';
+import 'package:path/path.dart' as p;
import 'package:which/which.dart';
/// Return the path to the current Dart SDK. This will return `null` if we are
@@ -45,6 +46,12 @@ Directory getSdkDir([List<String> cliArgs]) {
executable = link.resolveSymbolicLinksSync();
}
+ Link parentLink = new Link(p.dirname(executable));
+ if (parentLink.existsSync()) {
+ executable = p.join(
+ parentLink.resolveSymbolicLinksSync(), p.basename(executable));
+ }
+
File dartVm = new File(executable);
Directory dir = dartVm.parent.parent;
if (_isSdkDir(dir)) return dir;
« no previous file with comments | « CHANGELOG.md ('k') | pubspec.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698