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); |
+ }); |
+ } |
}); |
} |