Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(277)

Unified Diff: sdk/lib/_internal/pub/lib/src/command/serve.dart

Issue 23291002: Fix pub serve on windows. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | sdk/lib/_internal/pub/pub.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 49dc4a1abcf394d51f321242b0fe9abe352bcfe9..ad891dc398f9c860d8614459e3189f3987a6829c 100644
--- a/sdk/lib/_internal/pub/lib/src/command/serve.dart
+++ b/sdk/lib/_internal/pub/lib/src/command/serve.dart
@@ -226,8 +226,7 @@ class ServeCommand extends PubCommand {
var subdirectory = path.join(packageDir, name);
var watcher = new DirectoryWatcher(subdirectory);
watcher.events.listen((event) {
- var relativePath = path.relative(event.path, from: packageDir);
- var id = new AssetId(package, relativePath);
+ var id = pathToAssetId(package, packageDir, event.path);
if (event.type == ChangeType.REMOVE) {
_barback.removeSources([id]);
} else {
@@ -257,10 +256,7 @@ class ServeCommand extends PubCommand {
// Skip directories.
if (!fileExists(entry)) continue;
- // AssetId paths use "/" on all platforms.
- var relative = path.relative(entry, from: packageDir);
- relative = path.toUri(relative).path;
- files.add(new AssetId(package, relative));
+ files.add(pathToAssetId(package, packageDir, entry));
}
}
@@ -274,4 +270,14 @@ 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);
+ }
}
« no previous file with comments | « no previous file | sdk/lib/_internal/pub/pub.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698