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