| 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 'git_source.dart'; | 9 import 'git_source.dart'; |
| 10 import 'hosted_source.dart'; | 10 import 'hosted_source.dart'; |
| 11 import 'io.dart'; | 11 import 'io.dart'; |
| 12 import 'io.dart' as io show createTempDir; | 12 import 'io.dart' as io show createTempDir; |
| 13 import 'log.dart' as log; |
| 13 import 'package.dart'; | 14 import 'package.dart'; |
| 14 import 'sdk_source.dart'; | 15 import 'sdk_source.dart'; |
| 15 import 'source.dart'; | 16 import 'source.dart'; |
| 16 import 'source_registry.dart'; | 17 import 'source_registry.dart'; |
| 17 import 'utils.dart'; | 18 import 'utils.dart'; |
| 18 import 'version.dart'; | 19 import 'version.dart'; |
| 19 | 20 |
| 20 /** | 21 /** |
| 21 * The system-wide cache of installed packages. | 22 * The system-wide cache of installed packages. |
| 22 * | 23 * |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 /// temp directory to ensure that it's on the same volume as the pub system | 96 /// temp directory to ensure that it's on the same volume as the pub system |
| 96 /// cache so that it can move the directory from it. | 97 /// cache so that it can move the directory from it. |
| 97 Future<Directory> createTempDir() { | 98 Future<Directory> createTempDir() { |
| 98 return ensureDir(tempDir).chain((temp) { | 99 return ensureDir(tempDir).chain((temp) { |
| 99 return io.createTempDir(join(temp, 'dir')); | 100 return io.createTempDir(join(temp, 'dir')); |
| 100 }); | 101 }); |
| 101 } | 102 } |
| 102 | 103 |
| 103 /// Delete's the system cache's internal temp directory. | 104 /// Delete's the system cache's internal temp directory. |
| 104 Future deleteTempDir() { | 105 Future deleteTempDir() { |
| 106 log.fine('Clean up system cache temp directory $tempDir.'); |
| 105 return dirExists(tempDir).chain((exists) { | 107 return dirExists(tempDir).chain((exists) { |
| 106 if (!exists) return new Future.immediate(null); | 108 if (!exists) return new Future.immediate(null); |
| 107 return deleteDir(tempDir); | 109 return deleteDir(tempDir); |
| 108 }); | 110 }); |
| 109 } | 111 } |
| 110 } | 112 } |
| OLD | NEW |