Chromium Code Reviews| Index: utils/pub/source.dart |
| diff --git a/utils/pub/source.dart b/utils/pub/source.dart |
| index 777c1a0222fc8f8ffbd1e4e9229cc5ca77009279..a0d804779b05ab5bffa16b5c073f0165adcaeae8 100644 |
| --- a/utils/pub/source.dart |
| +++ b/utils/pub/source.dart |
| @@ -108,7 +108,19 @@ abstract class Source { |
| var path; |
| return systemCacheDirectory(id).then((p) { |
| path = p; |
| - if (dirExists(path)) return true; |
| + |
| + // See if it's already cached. |
| + if (!dirExists(path)) return false; |
| + |
| + // Heuristic to make sure the cached package didn't get deleted |
| + // somehow. If the directory is here but there's no pubspec, assume we |
| + // got borked and reinstall. |
|
nweiz
2013/02/13 00:19:21
What if just "lib" or the contents of "lib" got wi
Bob Nystrom
2013/02/13 01:27:11
Oh, great call. Duh.
Fixed this to look for an em
nweiz
2013/02/13 02:02:05
I feel like having the pubspec check as well is st
Bob Nystrom
2013/02/13 18:00:26
Done.
|
| + if (fileExists(join(path, 'pubspec.yaml'))) return true; |
| + |
| + // No pubspec, so wipe it out and reinstall. |
| + return deleteDir(path).then((_) => false); |
| + }).then((isInstalled) { |
| + if (isInstalled) return true; |
| ensureDir(dirname(path)); |
| return install(id, path); |
| }).then((found) { |