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

Unified Diff: utils/pub/entrypoint.dart

Issue 13116020: Clean up the semantics of io.dart operations w.r.t. symlinks. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Code review changes 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 | « utils/pub/command_lish.dart ('k') | 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 f6894160753067bd21a2301a2c5e79c8ac0a09aa..2b02f02ff19e79fec598def618fea8fbe6fea055 100644
--- a/utils/pub/entrypoint.dart
+++ b/utils/pub/entrypoint.dart
@@ -74,11 +74,11 @@ class Entrypoint {
var future = defer(() {
ensureDir(path.dirname(packageDir));
- if (dirExists(packageDir)) {
+ if (entryExists(packageDir)) {
// TODO(nweiz): figure out when to actually delete the directory, and
// when we can just re-use the existing symlink.
log.fine("Deleting package directory for ${id.name} before install.");
- deleteDir(packageDir);
+ deleteEntry(packageDir);
}
if (id.source.shouldCache) {
@@ -210,7 +210,7 @@ class Entrypoint {
/// exists. If it doesn't, this completes to an empty [LockFile].
LockFile loadLockFile() {
var lockFilePath = path.join(root.dir, 'pubspec.lock');
- if (!fileExists(lockFilePath)) return new LockFile.empty();
+ if (!entryExists(lockFilePath)) return new LockFile.empty();
return new LockFile.load(lockFilePath, cache.sources);
}
@@ -298,17 +298,7 @@ class Entrypoint {
Future _linkSecondaryPackageDir(String dir) {
return defer(() {
var symlink = path.join(dir, 'packages');
- // The order of if tests is significant here. fileExists() will return
- // true for a symlink (broken or not) but deleteFile() cannot be used
- // to delete a broken symlink on Windows. So we test for the directory
- // first since deleteDir() does work on symlinks.
- // TODO(rnystrom): Make deleteFile() work for symlinks on Windows so this
- // doesn't matter.
- if (dirExists(symlink)) {
- deleteDir(symlink);
- } else if (fileExists(symlink)) {
- deleteFile(symlink);
- }
+ if (entryExists(symlink)) deleteEntry(symlink);
return createSymlink(packagesDir, symlink, relative: true);
});
}
« no previous file with comments | « utils/pub/command_lish.dart ('k') | utils/pub/io.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698