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

Unified Diff: cli_util/lib/cli_util.dart

Issue 1400473008: Roll Observatory packages and add a roll script (Closed) Base URL: git@github.com:dart-lang/observatory_pub_packages.git@master
Patch Set: Created 5 years, 2 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 | « charted/pubspec.yaml ('k') | cli_util/pubspec.yaml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cli_util/lib/cli_util.dart
diff --git a/cli_util/lib/cli_util.dart b/cli_util/lib/cli_util.dart
deleted file mode 100644
index aff2c6799978a1445c485fdc512e0ae9fdfe69e4..0000000000000000000000000000000000000000
--- a/cli_util/lib/cli_util.dart
+++ /dev/null
@@ -1,68 +0,0 @@
-// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-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
-/// unable to locate the Dart SDK.
-Directory getSdkDir([List<String> cliArgs]) {
- // Look for --dart-sdk on the command line.
- if (cliArgs != null) {
- int index = cliArgs.indexOf('--dart-sdk');
-
- if (index != -1 && (index + 1 < cliArgs.length)) {
- return new Directory(cliArgs[index + 1]);
- }
-
- for (String arg in cliArgs) {
- if (arg.startsWith('--dart-sdk=')) {
- return new Directory(arg.substring('--dart-sdk='.length));
- }
- }
- }
-
- // Look in env['DART_SDK']
- if (Platform.environment['DART_SDK'] != null) {
- return new Directory(Platform.environment['DART_SDK']);
- }
-
- // Look relative to the dart executable.
- Directory sdkDirectory = new File(Platform.executable).parent.parent;
- if (_isSdkDir(sdkDirectory)) return sdkDirectory;
-
- // Try and locate the VM using 'which'.
- String executable = whichSync('dart', orElse: () => null);
-
- 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();
- }
-
- 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;
- }
-
- return null;
-}
-
-bool _isSdkDir(Directory dir) => _joinFile(dir, ['version']).existsSync();
-
-File _joinFile(Directory dir, List<String> files) {
- String pathFragment = files.join(Platform.pathSeparator);
- return new File("${dir.path}${Platform.pathSeparator}${pathFragment}");
-}
« no previous file with comments | « charted/pubspec.yaml ('k') | cli_util/pubspec.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698