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

Side by Side Diff: lib/src/system_cache.dart

Issue 2184303002: Make pub strong-mode clean. (Closed) Base URL: git@github.com:dart-lang/pub.git@master
Patch Set: Code review changes Created 4 years, 4 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 unified diff | Download patch
« no previous file with comments | « lib/src/source/hosted.dart ('k') | lib/src/utils.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 import 'dart:io'; 5 import 'dart:io';
6 6
7 import 'package:path/path.dart' as p; 7 import 'package:path/path.dart' as p;
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;
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 } 94 }
95 95
96 return new Package.load( 96 return new Package.load(
97 id.name, source(id.source).getDirectory(id), sources); 97 id.name, source(id.source).getDirectory(id), sources);
98 } 98 }
99 99
100 /// Determines if the system cache contains the package identified by [id]. 100 /// Determines if the system cache contains the package identified by [id].
101 bool contains(PackageId id) { 101 bool contains(PackageId id) {
102 var source = this.source(id.source); 102 var source = this.source(id.source);
103 103
104 if (source is! CachedSource) { 104 if (source is CachedSource) return source.isInSystemCache(id);
105 throw new ArgumentError("Package $id is not cacheable."); 105 throw new ArgumentError("Package $id is not cacheable.");
106 }
107
108 return source.isInSystemCache(id);
109 } 106 }
110 107
111 /// Create a new temporary directory within the system cache. 108 /// Create a new temporary directory within the system cache.
112 /// 109 ///
113 /// The system cache maintains its own temporary directory that it uses to 110 /// The system cache maintains its own temporary directory that it uses to
114 /// stage packages into while downloading. It uses this instead of the OS's 111 /// stage packages into while downloading. It uses this instead of the OS's
115 /// system temp directory to ensure that it's on the same volume as the pub 112 /// system temp directory to ensure that it's on the same volume as the pub
116 /// system cache so that it can move the directory from it. 113 /// system cache so that it can move the directory from it.
117 String createTempDir() { 114 String createTempDir() {
118 var temp = ensureDir(tempDir); 115 var temp = ensureDir(tempDir);
119 return io.createTempDir(temp, 'dir'); 116 return io.createTempDir(temp, 'dir');
120 } 117 }
121 118
122 /// Deletes the system cache's internal temp directory. 119 /// Deletes the system cache's internal temp directory.
123 void deleteTempDir() { 120 void deleteTempDir() {
124 log.fine('Clean up system cache temp directory $tempDir.'); 121 log.fine('Clean up system cache temp directory $tempDir.');
125 if (dirExists(tempDir)) deleteEntry(tempDir); 122 if (dirExists(tempDir)) deleteEntry(tempDir);
126 } 123 }
127 } 124 }
OLDNEW
« no previous file with comments | « lib/src/source/hosted.dart ('k') | lib/src/utils.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698