Skip to content

Commit ac93a3c

Browse files
Markzipancommit-bot@chromium.org
authored andcommitted
[dartdevc] Fixing windows-related source map pathing issues
Bug: #37364 Change-Id: If06a2a2737fbc55493ec3f0f607c3d75f7dc4546 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/107452 Reviewed-by: Jake Macdonald <jakemac@google.com> Commit-Queue: Mark Zhou <markzipan@google.com>
1 parent 7929e1c commit ac93a3c

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

pkg/dev_compiler/lib/src/compiler/shared_command.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -352,8 +352,8 @@ Map placeSourceMap(Map sourceMap, String sourceMapPath,
352352
{String multiRootOutputPath}) {
353353
var map = Map.from(sourceMap);
354354
// Convert to a local file path if it's not.
355-
sourceMapPath = path.fromUri(sourcePathToUri(sourceMapPath));
356-
var sourceMapDir = path.dirname(path.absolute(sourceMapPath));
355+
sourceMapPath = sourcePathToUri(path.absolute(path.fromUri(sourceMapPath))).path;
356+
var sourceMapDir = path.url.dirname(sourceMapPath);
357357
var list = (map['sources'] as List).toList();
358358

359359
String makeRelative(String sourcePath) {

pkg/dev_compiler/lib/src/kernel/command.dart

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,8 @@ Future<CompilerResult> _compile(List<String> args,
136136
var multiRootPaths = (argResults['multi-root'] as Iterable<String>)
137137
.map(Uri.base.resolve)
138138
.toList();
139-
var multiRootOutputPath =
140-
_longestPrefixingPath(path.absolute(output), multiRootPaths);
139+
var multiRootOutputPath = _longestPrefixingPath(
140+
sourcePathToUri(path.absolute(output)), multiRootPaths);
141141

142142
var fileSystem = MultiRootFileSystem(
143143
multiRootScheme, multiRootPaths, fe.StandardFileSystem.instance);
@@ -518,7 +518,8 @@ String _findPackagesFilePath() {
518518
}
519519

520520
/// Inputs must be absolute paths. Returns null if no prefixing path is found.
521-
String _longestPrefixingPath(String basePath, List<Uri> prefixingPaths) {
521+
String _longestPrefixingPath(Uri baseUri, List<Uri> prefixingPaths) {
522+
var basePath = baseUri.path;
522523
return prefixingPaths.fold(null, (String previousValue, Uri element) {
523524
if (basePath.startsWith(element.path) &&
524525
(previousValue == null || previousValue.length < element.path.length)) {

0 commit comments

Comments
 (0)