@@ -24,6 +24,7 @@ import 'package:analyzer/src/summary/summarize_elements.dart'
24
24
show PackageBundleAssembler;
25
25
import 'package:analyzer/src/task/strong/info.dart' show DynamicInvoke;
26
26
import 'package:source_maps/source_maps.dart' ;
27
+ import 'package:path/path.dart' show separator;
27
28
28
29
import '../closure/closure_annotator.dart' show ClosureAnnotator;
29
30
import '../js_ast/js_ast.dart' as JS;
@@ -145,8 +146,8 @@ class CodeGenerator extends GeneralizingAstVisitor
145
146
List <String > errors) {
146
147
_buildUnit = unit;
147
148
_buildRoot = _buildUnit.buildRoot;
148
- if (! _buildRoot.endsWith ('/' )) {
149
- _buildRoot = '$_buildRoot / ' ;
149
+ if (! _buildRoot.endsWith (separator )) {
150
+ _buildRoot = '$_buildRoot ${ separator } ' ;
150
151
}
151
152
152
153
var jsTree = _emitModule (compilationUnits);
@@ -4359,12 +4360,12 @@ String jsLibraryName(String buildRoot, LibraryElement library) {
4359
4360
// TODO(vsm): This is not unique if an escaped '/'appears in a filename.
4360
4361
// E.g., "foo/bar.dart" and "foo$47bar.dart" would collide.
4361
4362
qualifiedPath = uri.pathSegments.skip (1 ).join (separator);
4362
- } else if (uri.path .startsWith (buildRoot)) {
4363
+ } else if (uri.toFilePath () .startsWith (buildRoot)) {
4363
4364
qualifiedPath =
4364
4365
uri.path.substring (buildRoot.length).replaceAll ('/' , separator);
4365
4366
} else {
4366
4367
// We don't have a unique name.
4367
- throw 'Invalid build root. $buildRoot does not contain ${uri .path }' ;
4368
+ throw 'Invalid build root. $buildRoot does not contain ${uri .toFilePath () }' ;
4368
4369
}
4369
4370
return pathToJSIdentifier (qualifiedPath);
4370
4371
}
0 commit comments