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

Side by Side Diff: pkg/analyzer/lib/file_system/physical_file_system.dart

Issue 2058163002: Add Folder.getChildAssumingFile(). (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 6 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
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 analyzer.file_system.physical_file_system; 5 library analyzer.file_system.physical_file_system;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:core' hide Resource; 8 import 'dart:core' hide Resource;
9 import 'dart:io' as io; 9 import 'dart:io' as io;
10 10
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 return absolutePathContext.isWithin(this.path, path); 172 return absolutePathContext.isWithin(this.path, path);
173 } 173 }
174 174
175 @override 175 @override
176 Resource getChild(String relPath) { 176 Resource getChild(String relPath) {
177 String canonicalPath = canonicalizePath(relPath); 177 String canonicalPath = canonicalizePath(relPath);
178 return PhysicalResourceProvider.INSTANCE.getResource(canonicalPath); 178 return PhysicalResourceProvider.INSTANCE.getResource(canonicalPath);
179 } 179 }
180 180
181 @override 181 @override
182 _PhysicalFile getChildAssumingFile(String relPath) {
183 String canonicalPath = canonicalizePath(relPath);
184 io.File file = new io.File(canonicalPath);
185 return new _PhysicalFile(file);
186 }
187
188 @override
182 _PhysicalFolder getChildAssumingFolder(String relPath) { 189 _PhysicalFolder getChildAssumingFolder(String relPath) {
183 String canonicalPath = canonicalizePath(relPath); 190 String canonicalPath = canonicalizePath(relPath);
184 io.Directory directory = new io.Directory(canonicalPath); 191 io.Directory directory = new io.Directory(canonicalPath);
185 return new _PhysicalFolder(directory); 192 return new _PhysicalFolder(directory);
186 } 193 }
187 194
188 @override 195 @override
189 List<Resource> getChildren() { 196 List<Resource> getChildren() {
190 try { 197 try {
191 List<Resource> children = <Resource>[]; 198 List<Resource> children = <Resource>[];
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 bool operator ==(other) { 258 bool operator ==(other) {
252 if (runtimeType != other.runtimeType) { 259 if (runtimeType != other.runtimeType) {
253 return false; 260 return false;
254 } 261 }
255 return path == other.path; 262 return path == other.path;
256 } 263 }
257 264
258 @override 265 @override
259 String toString() => path; 266 String toString() => path;
260 } 267 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/file_system/memory_file_system.dart ('k') | pkg/analyzer/test/file_system/memory_file_system_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698