Index: utils/pub/entrypoint.dart |
diff --git a/utils/pub/entrypoint.dart b/utils/pub/entrypoint.dart |
index e1bed5f7f135e2eaa11e59adcc6d4f1d3b5ebc73..587ec6831e39810ae27b8de05002e976b10e545c 100644 |
--- a/utils/pub/entrypoint.dart |
+++ b/utils/pub/entrypoint.dart |
@@ -291,11 +291,17 @@ 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; |
+ if (fileExists(symlink)) deleteFile(symlink); |
+ if (dirExists(symlink)) { |
+ return deleteDir(symlink).then( |
+ (_) => createSymlink(packagesDir, symlink, relative: true)); |
+ } |
nweiz
2013/03/15 21:00:17
I'd probably write this as
return new Future
Bob Nystrom
2013/03/15 22:06:56
Done.
|
+ |
return createSymlink(packagesDir, symlink, relative: true); |
}); |
} |