| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 library system_cache; | 5 library system_cache; |
| 6 | 6 |
| 7 import 'dart:io'; | 7 import 'dart:io'; |
| 8 | 8 |
| 9 import 'io.dart'; | 9 import 'io.dart'; |
| 10 import 'io.dart' as io show createTempDir; | 10 import 'io.dart' as io show createTempDir; |
| 11 import 'log.dart' as log; |
| 11 import 'package.dart'; | 12 import 'package.dart'; |
| 12 import 'source.dart'; | 13 import 'source.dart'; |
| 13 import 'source_registry.dart'; | 14 import 'source_registry.dart'; |
| 14 import 'utils.dart'; | 15 import 'utils.dart'; |
| 15 import 'version.dart'; | 16 import 'version.dart'; |
| 16 | 17 |
| 17 /** | 18 /** |
| 18 * The system-wide cache of installed packages. | 19 * The system-wide cache of installed packages. |
| 19 * | 20 * |
| 20 * This cache contains all packages that are downloaded from the internet. | 21 * This cache contains all packages that are downloaded from the internet. |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 /// temp directory to ensure that it's on the same volume as the pub system | 83 /// temp directory to ensure that it's on the same volume as the pub system |
| 83 /// cache so that it can move the directory from it. | 84 /// cache so that it can move the directory from it. |
| 84 Future<Directory> createTempDir() { | 85 Future<Directory> createTempDir() { |
| 85 return ensureDir(tempDir).chain((temp) { | 86 return ensureDir(tempDir).chain((temp) { |
| 86 return io.createTempDir(join(temp, 'dir')); | 87 return io.createTempDir(join(temp, 'dir')); |
| 87 }); | 88 }); |
| 88 } | 89 } |
| 89 | 90 |
| 90 /// Delete's the system cache's internal temp directory. | 91 /// Delete's the system cache's internal temp directory. |
| 91 Future deleteTempDir() { | 92 Future deleteTempDir() { |
| 93 log.fine('Clean up system cache temp directory $tempDir.'); |
| 92 return dirExists(tempDir).chain((exists) { | 94 return dirExists(tempDir).chain((exists) { |
| 93 if (!exists) return new Future.immediate(null); | 95 if (!exists) return new Future.immediate(null); |
| 94 return deleteDir(tempDir); | 96 return deleteDir(tempDir); |
| 95 }); | 97 }); |
| 96 } | 98 } |
| 97 } | 99 } |
| OLD | NEW |