Fix DartDev run command failed reading Windows path On Windows platform, backslashes are used as path separator. (Forward slashes are also accepted by Windows APIs for most cases) But for an Uri backslashes will be percent-encoded in the Uri. The other problem is that "C:\directory" when passed into Uri, the drive letter will be misinterpreted into scheme (common schemes like "http" or "file"). Bug: https://github.com/dart-lang/sdk/issues/42874 Change-Id: I0fe287b65a5b4faeb791665d2fda9ea0a9744cc4 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/156363 Commit-Queue: Zichang Guo <zichangguo@google.com> Reviewed-by: Ben Konyi <bkonyi@google.com>
diff --git a/pkg/dartdev/lib/src/commands/run.dart b/pkg/dartdev/lib/src/commands/run.dart index 86b7637..d118dbc 100644 --- a/pkg/dartdev/lib/src/commands/run.dart +++ b/pkg/dartdev/lib/src/commands/run.dart
@@ -130,12 +130,9 @@ return 255; } } - - final script = Directory.current.uri - .resolve(args.firstWhere((e) => !e.startsWith('-'))) - .toFilePath(); + final path = args.firstWhere((e) => !e.startsWith('-')); final runArgs = args.length == 1 ? <String>[] : args.sublist(1); - VmInteropHandler.run(script, runArgs); + VmInteropHandler.run(path, runArgs); return 0; } }