Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix some minor Windows issues #6783

Merged
merged 3 commits into from
Nov 21, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class ExtensionsManager {
try {
extensions = await findExtensions(
'devtools',
packageConfig: Uri.parse(
packageConfig: Uri.file(
path.join(
rootPath,
'.dart_tool',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ void main() {
setUp(() {
options = DevToolsOptions();
tmpDir = Directory.current.createTempSync();
tmpUri = Uri.parse(tmpDir.path);
tmpUri = Uri.file(tmpDir.path);
});

tearDown(() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ void main() {

Directory _createFromDir() {
final from = Directory('tmp')..createSync();
File.fromUri(Uri.parse(p.join(from.path, 'foo.txt')))..createSync();
File(p.join(from.path, 'foo.txt'))..createSync();
final dir = Directory(p.join(from.path, 'bar'))..createSync();
File.fromUri(Uri.parse(p.join(dir.path, 'baz.txt')))..createSync();
File(p.join(dir.path, 'baz.txt'))..createSync();
final contents = _contentAsOrderedString(from);
expect(
contents,
Expand All @@ -65,5 +65,17 @@ Directory _createToDir() {
String _contentAsOrderedString(Directory dir) {
final contents = dir.listSync(recursive: true)
..sort((a, b) => a.path.compareTo(b.path));
return contents.toString();
return contents
// Always use posix paths so that expectations can be consistent between
// Mac/Windows.
.map(
(e) =>
"${e is Directory ? 'Directory' : 'File'}: '${posixPath(e.path)}'",
)
.toList()
.toString();
}

/// Returns a relative path [input] with posix/forward slashes regardless of
/// the current platform.
String posixPath(String input) => p.posix.joinAll(p.split(input));
Loading