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

Unified Diff: utils/pub/entrypoint.dart

Issue 12772005: Handle broken symlinks when creating package dirs. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Revise. Created 7 years, 9 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 | utils/pub/io.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: utils/pub/entrypoint.dart
diff --git a/utils/pub/entrypoint.dart b/utils/pub/entrypoint.dart
index e1bed5f7f135e2eaa11e59adcc6d4f1d3b5ebc73..a6afb14a2109bce79ffd3a9b0aef6481ef243e1c 100644
--- a/utils/pub/entrypoint.dart
+++ b/utils/pub/entrypoint.dart
@@ -291,12 +291,18 @@ class Entrypoint {
}).then(flatten);
}
- /// Creates a symlink to the `packages` directory in [dir] if none exists.
+ /// Creates a symlink to the `packages` directory in [dir]. Will replace one
+ /// if already there.
Future _linkSecondaryPackageDir(String dir) {
return defer(() {
var symlink = path.join(dir, 'packages');
- if (entryExists(symlink)) return;
- return createSymlink(packagesDir, symlink, relative: true);
+ return new Future.of(() {
+ if (fileExists(symlink)) {
+ deleteFile(symlink);
+ } else if (dirExists(symlink)) {
+ return deleteDir(symlink);
+ }
+ }).then((_) => createSymlink(packagesDir, symlink, relative: true));
});
}
}
« no previous file with comments | « no previous file | utils/pub/io.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698