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

Side by Side Diff: packages/which/lib/src/candidate_paths.dart

Issue 2989763002: Update charted to 0.4.8 and roll (Closed)
Patch Set: Removed Cutch from list of reviewers Created 3 years, 4 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 | « packages/which/drone.sh ('k') | packages/which/lib/src/has_permission.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
2 library which.src.candidate_paths;
3
4 import 'dart:io';
5
6 import 'package:path/path.dart';
7
8 Iterable<String> getCandidatePaths(String command, Map<String, String> environme nt, bool isWindows, Context context) {
9 if (context.isAbsolute(command)) return [command];
10
11 String getEnvVar(String envVar, String defaultValue) {
12 var v = environment[envVar];
13 return v == null ? defaultValue : v;
14 }
15
16 var pathVarSeparator = isWindows ? ";" : ":";
17
18 List<String> splitEnvVar(String envVar, String defaultValue) =>
19 getEnvVar(envVar, defaultValue).split(pathVarSeparator);
20
21 var pathEnv = splitEnvVar('PATH', '');
22
23 var noExtPaths =
24 pathEnv.map((pathEntry) => context.join(pathEntry, command));
25
26 if (!isWindows) return noExtPaths;
27
28 pathEnv.insert(0, context.current);
29 var pathExt = splitEnvVar('PATHEXT', ".EXE");
30 if (command.contains('.')) pathExt.insert(0, '');
31 return noExtPaths.expand((commandPath) =>
32 pathExt.map((pathExtEntry) => commandPath + pathExtEntry));
33 }
34
35 Iterable<String> getRealCandidatePaths(String command) =>
36 getCandidatePaths(command, Platform.environment, Platform.isWindows, context );
OLDNEW
« no previous file with comments | « packages/which/drone.sh ('k') | packages/which/lib/src/has_permission.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698