| 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 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'; | 10 import 'dart:core'; |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 @override | 43 @override |
| 44 pathos.Context get pathContext => _pathContext; | 44 pathos.Context get pathContext => _pathContext; |
| 45 | 45 |
| 46 /** | 46 /** |
| 47 * Convert the given posix [path] to conform to this provider's path context. | 47 * Convert the given posix [path] to conform to this provider's path context. |
| 48 * | 48 * |
| 49 * This is a utility method for testing; paths passed in to other methods in | 49 * This is a utility method for testing; paths passed in to other methods in |
| 50 * this class are never converted automatically. | 50 * this class are never converted automatically. |
| 51 */ | 51 */ |
| 52 String convertPath(String path) { | 52 String convertPath(String path) { |
| 53 if (pathContext == pathos.windows && | 53 if (pathContext.style == pathos.windows.style && |
| 54 path.startsWith(pathos.posix.separator)) { | 54 path.startsWith(pathos.posix.separator)) { |
| 55 path = r'C:' + | 55 path = r'C:' + |
| 56 path.replaceAll(pathos.posix.separator, pathos.windows.separator); | 56 path.replaceAll(pathos.posix.separator, pathos.windows.separator); |
| 57 } | 57 } |
| 58 return path; | 58 return path; |
| 59 } | 59 } |
| 60 | 60 |
| 61 /** | 61 /** |
| 62 * Delete the file with the given path. | 62 * Delete the file with the given path. |
| 63 */ | 63 */ |
| (...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 334 File renameSync(String newPath) { | 334 File renameSync(String newPath) { |
| 335 throw new FileSystemException(path, 'File could not be renamed'); | 335 throw new FileSystemException(path, 'File could not be renamed'); |
| 336 } | 336 } |
| 337 | 337 |
| 338 @override | 338 @override |
| 339 File resolveSymbolicLinksSync() { | 339 File resolveSymbolicLinksSync() { |
| 340 return throw new FileSystemException(path, "File does not exist"); | 340 return throw new FileSystemException(path, "File does not exist"); |
| 341 } | 341 } |
| 342 | 342 |
| 343 @override | 343 @override |
| 344 Uri toUri() => | |
| 345 new Uri.file(path, windows: _provider.pathContext == pathos.windows); | |
| 346 | |
| 347 @override | |
| 348 void writeAsBytesSync(List<int> bytes) { | 344 void writeAsBytesSync(List<int> bytes) { |
| 349 throw new FileSystemException(path, 'File could not be written'); | 345 throw new FileSystemException(path, 'File could not be written'); |
| 350 } | 346 } |
| 351 | 347 |
| 352 @override | 348 @override |
| 353 void writeAsStringSync(String content) { | 349 void writeAsStringSync(String content) { |
| 354 throw new FileSystemException(path, 'File could not be written'); | 350 throw new FileSystemException(path, 'File could not be written'); |
| 355 } | 351 } |
| 356 } | 352 } |
| 357 | 353 |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 559 } | 555 } |
| 560 return path == other.path; | 556 return path == other.path; |
| 561 } | 557 } |
| 562 | 558 |
| 563 @override | 559 @override |
| 564 String toString() => path; | 560 String toString() => path; |
| 565 | 561 |
| 566 @override | 562 @override |
| 567 Uri toUri() => _provider.pathContext.toUri(path); | 563 Uri toUri() => _provider.pathContext.toUri(path); |
| 568 } | 564 } |
| OLD | NEW |