-
Notifications
You must be signed in to change notification settings - Fork 33
Conversation
84641b6
to
5e8d31a
Compare
test/record_test.dart
Outdated
@@ -15,6 +16,7 @@ import 'utils.dart'; | |||
|
|||
void main() { | |||
FileSystem fs = new LocalFileSystem(); | |||
String newline = Platform.isWindows ? '\r\n' : '\n'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI, I just created dart-lang/platform#1 -- maybe add a comment referencing it here so that when it's implemented, we can switch to use it here.
/// | ||
/// Return `null` if the executable cannot be found. | ||
@visibleForTesting | ||
String getExecutablePath(String commandName, String workingDirectory, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Put in a separate common.dart
that's not exported by the library -- so the test can still import it under lib/src, but package users don't get it by accident.
/// Return `null` if the executable cannot be found. | ||
@visibleForTesting | ||
String getExecutablePath(String commandName, String workingDirectory, | ||
{bool isWindows, List<String> path, List<String> pathExt}) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rather than bool isWindows
, make it Platform platform
from package:platform
(rather than dart:io
's native Platform
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a beautiful abstraction. So much nicer!
{bool isWindows, List<String> path, List<String> pathExt}) { | ||
workingDirectory ??= Directory.current.path; | ||
isWindows ??= Platform.isWindows; | ||
String pathSeparator = isWindows ? ';' : ':'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another TODO to refactor once the API is available: dart-lang/platform#2
Iterable<String> _getCandidatePaths( | ||
String commandName, List<String> searchPaths, List<String> extensions) { | ||
List<String> withExtensions = extensions.isNotEmpty | ||
? extensions.map((String ext) => '$commandName$ext').toList() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would you ever want to include the version without the extension as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That wouldn't work in Windows. In flutter, we do have bin/flutter and bin/flutter.bat, but only the later is executable on Windows. As far as I can tell, windows doesn't have a concept of executables without extensions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ack
lib/src/record_replay/manifest.dart
Outdated
@@ -48,7 +50,13 @@ class Manifest { | |||
List<Map<String, dynamic>> decoded = new JsonDecoder().convert(json); | |||
Manifest manifest = new Manifest(); | |||
decoded.forEach((Map<String, dynamic> entry) { | |||
manifest._entries.add(new ManifestEntry.fromJson(entry)); | |||
if (entry['type'] == 'run') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
switch (entry['type']) { ... }
04f5f5d
to
bb1cbc8
Compare
lib/src/interface/common.dart
Outdated
@@ -0,0 +1,56 @@ | |||
import 'dart:io'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needs license header
bb1cbc8
to
1f93467
Compare
Update |
9bb2f57
to
84641b6
Compare
LocalProcessManager now uses the same algorithm on Windows and Posix systems to find the executable for a command. Previously, manager.run(['pub']) would work on Linux, but not on Windows because 'pub.bat' could not be located.
84641b6
to
d027c66
Compare
LocalProcessManager
now uses the same algorithm on Windows and Posix systems to find the executable for a command.Previously,
manager.run(['pub'])
would work on Linux, but not on Windows becausepub.bat
could not be located.