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