Skip to content

Commit bdc173d

Browse files
committed
1 parent 2a37f44 commit bdc173d

File tree

2 files changed

+12
-9
lines changed

2 files changed

+12
-9
lines changed

sdk/lib/_internal/pub/lib/src/command/serve.dart

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -226,8 +226,7 @@ class ServeCommand extends PubCommand {
226226
var subdirectory = path.join(packageDir, name);
227227
var watcher = new DirectoryWatcher(subdirectory);
228228
watcher.events.listen((event) {
229-
var relativePath = path.relative(event.path, from: packageDir);
230-
var id = new AssetId(package, relativePath);
229+
var id = pathToAssetId(package, packageDir, event.path);
231230
if (event.type == ChangeType.REMOVE) {
232231
_barback.removeSources([id]);
233232
} else {
@@ -257,10 +256,7 @@ class ServeCommand extends PubCommand {
257256
// Skip directories.
258257
if (!fileExists(entry)) continue;
259258

260-
// AssetId paths use "/" on all platforms.
261-
var relative = path.relative(entry, from: packageDir);
262-
relative = path.toUri(relative).path;
263-
files.add(new AssetId(package, relative));
259+
files.add(pathToAssetId(package, packageDir, entry));
264260
}
265261
}
266262

@@ -274,4 +270,14 @@ class ServeCommand extends PubCommand {
274270
if (package == entrypoint.root.name) directories.add("web");
275271
return directories;
276272
}
273+
274+
/// Converts a local file path to an [AssetId].
275+
AssetId pathToAssetId(String package, String packageDir, String filePath) {
276+
var relative = path.relative(filePath, from: packageDir);
277+
278+
// AssetId paths use "/" on all platforms.
279+
relative = path.toUri(relative).path;
280+
281+
return new AssetId(package, relative);
282+
}
277283
}

sdk/lib/_internal/pub/pub.status

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,3 @@
99
# Pub only runs on the standalone VM, not the browser.
1010
[ $runtime == drt || $runtime == dartium || $runtime == opera ]
1111
*: Skip
12-
13-
[ $system == windows ]
14-
test/serve/watch_added_file_test: Pass, Fail # Issue 12500.

0 commit comments

Comments
 (0)