Skip to content

Commit

Permalink
fix path normalization for windows
Browse files Browse the repository at this point in the history
See: flutter/flutter#105641 (comment)

Change-Id: I176467d5885feab1c44892ea9140f619e30df223
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/247608
Commit-Queue: Phil Quitslund <[email protected]>
Reviewed-by: Srujan Gaddam <[email protected]>
  • Loading branch information
pq authored and Commit Bot committed Jun 9, 2022
1 parent 6025598 commit 8d9009d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions pkg/dartdev/lib/src/commands/fix.dart
Original file line number Diff line number Diff line change
Expand Up @@ -268,11 +268,13 @@ To use the tool, run either ['dart fix --dry-run'] for a preview of the proposed

io.FileSystemEntity _getTarget(List<String> arguments) {
var argumentCount = arguments.length;
if (argumentCount == 0) return io.Directory.current.absolute;
if (argumentCount > 1) {
usageException('Only one file or directory is expected.');
}
var normalizedPath = path.canonicalize(path.normalize(arguments[0]));

var basePath =
argumentCount == 0 ? io.Directory.current.absolute.path : arguments[0];
var normalizedPath = path.canonicalize(path.normalize(basePath));
return io.FileSystemEntity.isDirectorySync(normalizedPath)
? io.Directory(normalizedPath)
: io.File(normalizedPath);
Expand Down

0 comments on commit 8d9009d

Please sign in to comment.