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

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

Issue 2270593003: Add support for resolving symbolic links (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: comment clean-up Created 4 years, 3 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.memory_file_system; 5 library analyzer.file_system.memory_file_system;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:collection'; 8 import 'dart:collection';
9 import 'dart:convert'; 9 import 'dart:convert';
10 import 'dart:core' hide Resource; 10 import 'dart:core' hide Resource;
(...skipping 12 matching lines...) Expand all
23 class MemoryResourceProvider implements ResourceProvider { 23 class MemoryResourceProvider implements ResourceProvider {
24 final Map<String, _MemoryResource> _pathToResource = 24 final Map<String, _MemoryResource> _pathToResource =
25 new HashMap<String, _MemoryResource>(); 25 new HashMap<String, _MemoryResource>();
26 final Map<String, List<int>> _pathToBytes = new HashMap<String, List<int>>(); 26 final Map<String, List<int>> _pathToBytes = new HashMap<String, List<int>>();
27 final Map<String, int> _pathToTimestamp = new HashMap<String, int>(); 27 final Map<String, int> _pathToTimestamp = new HashMap<String, int>();
28 final Map<String, List<StreamController<WatchEvent>>> _pathToWatchers = 28 final Map<String, List<StreamController<WatchEvent>>> _pathToWatchers =
29 new HashMap<String, List<StreamController<WatchEvent>>>(); 29 new HashMap<String, List<StreamController<WatchEvent>>>();
30 int nextStamp = 0; 30 int nextStamp = 0;
31 31
32 final Context _pathContext; 32 final Context _pathContext;
33
33 @override 34 @override
34 final AbsolutePathContext absolutePathContext; 35 final AbsolutePathContext absolutePathContext;
35 36
36 MemoryResourceProvider({bool isWindows: false}) 37 MemoryResourceProvider({bool isWindows: false})
37 : _pathContext = isWindows ? windows : posix, 38 : _pathContext = isWindows ? windows : posix,
38 absolutePathContext = new AbsolutePathContext(isWindows); 39 absolutePathContext = new AbsolutePathContext(isWindows);
39 40
40 @override 41 @override
41 Context get pathContext => _pathContext; 42 Context get pathContext => _pathContext;
42 43
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
302 String readAsStringSync() { 303 String readAsStringSync() {
303 throw new FileSystemException(path, 'File could not be read'); 304 throw new FileSystemException(path, 'File could not be read');
304 } 305 }
305 306
306 @override 307 @override
307 File renameSync(String newPath) { 308 File renameSync(String newPath) {
308 throw new FileSystemException(path, 'File could not be renamed'); 309 throw new FileSystemException(path, 'File could not be renamed');
309 } 310 }
310 311
311 @override 312 @override
313 File resolveSymbolicLinksSync() {
314 return throw new FileSystemException(path, "File does not exist");
315 }
316
317 @override
312 Uri toUri() => new Uri.file(path, windows: _provider.pathContext == windows); 318 Uri toUri() => new Uri.file(path, windows: _provider.pathContext == windows);
313 319
314 @override 320 @override
315 void writeAsBytesSync(List<int> bytes) { 321 void writeAsBytesSync(List<int> bytes) {
316 throw new FileSystemException(path, 'File could not be written'); 322 throw new FileSystemException(path, 'File could not be written');
317 } 323 }
318 324
319 @override 325 @override
320 void writeAsStringSync(String content) { 326 void writeAsStringSync(String content) {
321 throw new FileSystemException(path, 'File could not be written'); 327 throw new FileSystemException(path, 'File could not be written');
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 } 380 }
375 return UTF8.decode(content); 381 return UTF8.decode(content);
376 } 382 }
377 383
378 @override 384 @override
379 File renameSync(String newPath) { 385 File renameSync(String newPath) {
380 return _provider.renameFileSync(this, newPath); 386 return _provider.renameFileSync(this, newPath);
381 } 387 }
382 388
383 @override 389 @override
390 File resolveSymbolicLinksSync() => this;
391
392 @override
384 Uri toUri() => new Uri.file(path, windows: _provider.pathContext == windows); 393 Uri toUri() => new Uri.file(path, windows: _provider.pathContext == windows);
385 394
386 @override 395 @override
387 void writeAsBytesSync(List<int> bytes) { 396 void writeAsBytesSync(List<int> bytes) {
388 _provider._setFileContent(this, bytes); 397 _provider._setFileContent(this, bytes);
389 } 398 }
390 399
391 @override 400 @override
392 void writeAsStringSync(String content) { 401 void writeAsStringSync(String content) {
393 _provider._setFileContent(this, UTF8.encode(content)); 402 _provider._setFileContent(this, UTF8.encode(content));
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
524 bool operator ==(other) { 533 bool operator ==(other) {
525 if (runtimeType != other.runtimeType) { 534 if (runtimeType != other.runtimeType) {
526 return false; 535 return false;
527 } 536 }
528 return path == other.path; 537 return path == other.path;
529 } 538 }
530 539
531 @override 540 @override
532 String toString() => path; 541 String toString() => path;
533 } 542 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/file_system/file_system.dart ('k') | pkg/analyzer/lib/file_system/physical_file_system.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698