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

Unified Diff: utils/pub/entrypoint.dart

Issue 10907036: Hide self-referential symlinks behind a flag in pub. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 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 | utils/pub/pub.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 86ad2131412fa62be429fa5100757e156ea4e340..f32e9a595c1b679323d0decda1d90980ebef7c0e 100644
--- a/utils/pub/entrypoint.dart
+++ b/utils/pub/entrypoint.dart
@@ -31,6 +31,9 @@
* but may be the entrypoint when you're running its tests.
*/
class Entrypoint {
+ // TODO(rnystrom): Get rid of this when #4820 is fixed.
+ static bool installSelfLink = false;
+
/**
* The root package this entrypoint is associated with.
*/
@@ -223,8 +226,18 @@ class Entrypoint {
Future _installSelfReference(_) {
var linkPath = join(path, root.name);
return exists(linkPath).chain((exists) {
- if (exists) return new Future.immediate(null);
- return ensureDir(path).chain((_) => createSymlink(root.dir, linkPath));
+ if (installSelfLink) {
+ // Create the symlink if it doesn't exist.
+ if (exists) return new Future.immediate(null);
+ return ensureDir(path).chain((_) => createSymlink(root.dir, linkPath));
+ } else {
+ // TODO(rnystrom): Get rid of this branch when #4820 is fixed.
+ // Delete the old one if it's there.
+ return ensureDir(path).chain((_) {
+ if (!exists) return new Future.immediate(null);
+ return deleteDir(linkPath);
+ });
+ }
});
}
« no previous file with comments | « no previous file | utils/pub/pub.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698