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

Side by Side Diff: pkg/analyzer/lib/src/util/sdk.dart

Issue 2844883005: Use the dart:io Platform.resolvedExecutable API to locate the Dart SDK. (Closed)
Patch Set: Created 3 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 unified diff | Download patch
« no previous file with comments | « pkg/analyzer/lib/src/lint/analysis.dart ('k') | pkg/analyzer_cli/lib/src/options.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file.
4
5 import 'dart:io';
6
7 import 'package:path/path.dart' as path;
8
9 String getSdkPath([List<String> args]) {
10 // Look for --dart-sdk on the command line.
11 if (args != null) {
12 int index = args.indexOf('--dart-sdk');
13
14 if (index != -1 && (index + 1 < args.length)) {
15 return args[index + 1];
16 }
17
18 for (String arg in args) {
19 if (arg.startsWith('--dart-sdk=')) {
20 return arg.substring('--dart-sdk='.length);
21 }
22 }
23 }
24
25 // Look in env['DART_SDK']
26 if (Platform.environment['DART_SDK'] != null) {
27 return Platform.environment['DART_SDK'];
28 }
29
30 // Use Platform.resolvedExecutable.
31 return path.dirname(path.dirname(Platform.resolvedExecutable));
32 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/lint/analysis.dart ('k') | pkg/analyzer_cli/lib/src/options.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698