Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 memory_file_system; | 5 library memory_file_system; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:collection'; | 8 import 'dart:collection'; |
| 9 | 9 |
| 10 import 'package:analyzer/src/generated/engine.dart' show TimestampedData; | 10 import 'package:analyzer/src/generated/engine.dart' show TimestampedData; |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 58 @override | 58 @override |
| 59 Resource getResource(String path) { | 59 Resource getResource(String path) { |
| 60 path = posix.normalize(path); | 60 path = posix.normalize(path); |
| 61 Resource resource = _pathToResource[path]; | 61 Resource resource = _pathToResource[path]; |
| 62 if (resource == null) { | 62 if (resource == null) { |
| 63 resource = new _MemoryFile(this, path); | 63 resource = new _MemoryFile(this, path); |
| 64 } | 64 } |
| 65 return resource; | 65 return resource; |
| 66 } | 66 } |
| 67 | 67 |
| 68 @override | |
| 69 Folder getStateLocation(String pluginId) { | |
| 70 return newFolder('/user/home/$pluginId'); | |
|
Brian Wilkerson
2014/10/07 15:55:23
I'm tempted to use an invalid folder name in the p
| |
| 71 } | |
| 72 | |
| 68 void modifyFile(String path, String content) { | 73 void modifyFile(String path, String content) { |
| 69 _checkFileAtPath(path); | 74 _checkFileAtPath(path); |
| 70 _pathToContent[path] = content; | 75 _pathToContent[path] = content; |
| 71 _pathToTimestamp[path] = nextStamp++; | 76 _pathToTimestamp[path] = nextStamp++; |
| 72 _notifyWatchers(path, ChangeType.MODIFY); | 77 _notifyWatchers(path, ChangeType.MODIFY); |
| 73 } | 78 } |
| 74 | 79 |
| 75 /** | 80 /** |
| 76 * Create a resource representing a dummy link (that is, a File object which | 81 * Create a resource representing a dummy link (that is, a File object which |
| 77 * appears in its parent directory, but whose `exists` property is false) | 82 * appears in its parent directory, but whose `exists` property is false) |
| (...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 374 bool operator ==(other) { | 379 bool operator ==(other) { |
| 375 if (runtimeType != other.runtimeType) { | 380 if (runtimeType != other.runtimeType) { |
| 376 return false; | 381 return false; |
| 377 } | 382 } |
| 378 return path == other.path; | 383 return path == other.path; |
| 379 } | 384 } |
| 380 | 385 |
| 381 @override | 386 @override |
| 382 String toString() => path; | 387 String toString() => path; |
| 383 } | 388 } |
| OLD | NEW |