Index: sdk/lib/_internal/pub/lib/src/command/serve.dart |
diff --git a/sdk/lib/_internal/pub/lib/src/command/serve.dart b/sdk/lib/_internal/pub/lib/src/command/serve.dart |
index ad891dc398f9c860d8614459e3189f3987a6829c..63934280d8204a3e76bad095c709369b6819fc52 100644 |
--- a/sdk/lib/_internal/pub/lib/src/command/serve.dart |
+++ b/sdk/lib/_internal/pub/lib/src/command/serve.dart |
@@ -226,7 +226,8 @@ class ServeCommand extends PubCommand { |
var subdirectory = path.join(packageDir, name); |
var watcher = new DirectoryWatcher(subdirectory); |
watcher.events.listen((event) { |
- var id = pathToAssetId(package, packageDir, event.path); |
+ var id = new AssetId(package, |
+ path.relative(event.path, from: packageDir)); |
if (event.type == ChangeType.REMOVE) { |
_barback.removeSources([id]); |
} else { |
@@ -256,7 +257,8 @@ class ServeCommand extends PubCommand { |
// Skip directories. |
if (!fileExists(entry)) continue; |
- files.add(pathToAssetId(package, packageDir, entry)); |
+ var id = new AssetId(package, path.relative(entry, from: packageDir)); |
+ files.add(id); |
} |
} |
@@ -270,14 +272,4 @@ class ServeCommand extends PubCommand { |
if (package == entrypoint.root.name) directories.add("web"); |
return directories; |
} |
- |
- /// Converts a local file path to an [AssetId]. |
- AssetId pathToAssetId(String package, String packageDir, String filePath) { |
- var relative = path.relative(filePath, from: packageDir); |
- |
- // AssetId paths use "/" on all platforms. |
- relative = path.toUri(relative).path; |
- |
- return new AssetId(package, relative); |
- } |
} |