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 physical_file_system; | 5 library physical_file_system; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:io' as io; | 8 import 'dart:io' as io; |
| 9 | 9 |
| 10 import 'package:analyzer/src/generated/java_io.dart'; | 10 import 'package:analyzer/src/generated/java_io.dart'; |
| 11 import 'package:analyzer/src/generated/source_io.dart'; | 11 import 'package:analyzer/src/generated/source_io.dart'; |
| 12 import 'package:path/path.dart'; | 12 import 'package:path/path.dart'; |
| 13 import 'package:watcher/watcher.dart'; | 13 import 'package:watcher/watcher.dart'; |
| 14 | 14 |
| 15 import 'file_system.dart'; | 15 import 'file_system.dart'; |
| 16 | 16 |
| 17 | 17 |
| 18 /** | 18 /** |
| 19 * A `dart:io` based implementation of [ResourceProvider]. | 19 * A `dart:io` based implementation of [ResourceProvider]. |
| 20 */ | 20 */ |
| 21 class PhysicalResourceProvider implements ResourceProvider { | 21 class PhysicalResourceProvider implements ResourceProvider { |
| 22 | |
| 23 static final NORMALIZE_EOL_MODE = | |
|
Brian Wilkerson
2015/01/20 18:56:14
Unless I missed something, there doesn't appear to
jwren
2015/01/20 21:38:14
Done.
| |
| 24 (String string) => string.replaceAll('\r\n', '\n'); | |
|
Paul Berry
2015/01/20 19:10:53
Based on previous email discussions, I believe the
jwren
2015/01/20 21:38:14
Done. As we discussed, I remembered this but left
| |
| 25 | |
| 22 static final PhysicalResourceProvider INSTANCE = | 26 static final PhysicalResourceProvider INSTANCE = |
| 23 new PhysicalResourceProvider._(); | 27 new PhysicalResourceProvider._(null); |
| 28 | |
| 29 static final PhysicalResourceProvider INSTANCE_NORMALIZE_EOL = | |
| 30 new PhysicalResourceProvider._(NORMALIZE_EOL_MODE); | |
| 24 | 31 |
| 25 /** | 32 /** |
| 26 * The name of the directory containing plugin specific subfolders used to | 33 * The name of the directory containing plugin specific subfolders used to |
| 27 * store data across sessions. | 34 * store data across sessions. |
| 28 */ | 35 */ |
| 29 static final String SERVER_DIR = ".dartServer"; | 36 static final String SERVER_DIR = ".dartServer"; |
| 30 | 37 |
| 31 PhysicalResourceProvider._(); | 38 PhysicalResourceProvider._(String fileReadMode(String s)) { |
|
Paul Berry
2015/01/20 19:10:53
Rather than having a private constructor and two i
jwren
2015/01/20 21:38:14
Done.
| |
| 39 if(fileReadMode != null) { | |
| 40 FileBasedSource.fileReadMode = fileReadMode; | |
| 41 } | |
| 42 } | |
| 32 | 43 |
| 33 @override | 44 @override |
| 34 Context get pathContext => io.Platform.isWindows ? windows : posix; | 45 Context get pathContext => io.Platform.isWindows ? windows : posix; |
| 35 | 46 |
| 36 @override | 47 @override |
| 37 Resource getResource(String path) { | 48 Resource getResource(String path) { |
| 38 if (io.FileSystemEntity.isDirectorySync(path)) { | 49 if (io.FileSystemEntity.isDirectorySync(path)) { |
| 39 io.Directory directory = new io.Directory(path); | 50 io.Directory directory = new io.Directory(path); |
| 40 return new _PhysicalFolder(directory); | 51 return new _PhysicalFolder(directory); |
| 41 } else { | 52 } else { |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 171 bool operator ==(other) { | 182 bool operator ==(other) { |
| 172 if (runtimeType != other.runtimeType) { | 183 if (runtimeType != other.runtimeType) { |
| 173 return false; | 184 return false; |
| 174 } | 185 } |
| 175 return path == other.path; | 186 return path == other.path; |
| 176 } | 187 } |
| 177 | 188 |
| 178 @override | 189 @override |
| 179 String toString() => path; | 190 String toString() => path; |
| 180 } | 191 } |
| OLD | NEW |