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:core' hide Resource; | 8 import 'dart:core' hide Resource; |
| 9 import 'dart:io' as io; | 9 import 'dart:io' as io; |
| 10 | 10 |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 32 static final String SERVER_DIR = ".dartServer"; | 32 static final String SERVER_DIR = ".dartServer"; |
| 33 | 33 |
| 34 PhysicalResourceProvider(String fileReadMode(String s)) { | 34 PhysicalResourceProvider(String fileReadMode(String s)) { |
| 35 if (fileReadMode != null) { | 35 if (fileReadMode != null) { |
| 36 FileBasedSource.fileReadMode = fileReadMode; | 36 FileBasedSource.fileReadMode = fileReadMode; |
| 37 } | 37 } |
| 38 } | 38 } |
| 39 | 39 |
| 40 @override | 40 @override |
| 41 Context get pathContext => io.Platform.isWindows ? windows : posix; | 41 Context get pathContext => io.Platform.isWindows ? windows : posix; |
| 42 | 42 |
| 43 /** | |
| 44 * Return a [File] that corresponds to the given [path]. | |
| 45 * | |
| 46 * A file may or may not exist at this location. | |
| 47 */ | |
| 48 File getFile(String path) => new _PhysicalFile(new io.File(path)); | |
|
Paul Berry
2015/07/01 15:55:40
These two methods should be marked with "@override
| |
| 49 | |
| 50 /** | |
| 51 * Return a [Folder] that corresponds to the given [path]. | |
| 52 * | |
| 53 * A folder may or may not exist at this location. | |
| 54 */ | |
| 55 Folder getFolder(String path) => new _PhysicalFolder(new io.Directory(path)); | |
| 56 | |
| 43 @override | 57 @override |
| 44 Resource getResource(String path) { | 58 Resource getResource(String path) { |
| 45 if (io.FileSystemEntity.isDirectorySync(path)) { | 59 if (io.FileSystemEntity.isDirectorySync(path)) { |
| 46 io.Directory directory = new io.Directory(path); | 60 return getFolder(path); |
| 47 return new _PhysicalFolder(directory); | |
| 48 } else { | 61 } else { |
| 49 io.File file = new io.File(path); | 62 return getFile(path); |
| 50 return new _PhysicalFile(file); | |
| 51 } | 63 } |
| 52 } | 64 } |
| 53 | 65 |
| 54 @override | 66 @override |
| 55 Folder getStateLocation(String pluginId) { | 67 Folder getStateLocation(String pluginId) { |
| 56 String home; | 68 String home; |
| 57 if (io.Platform.isWindows) { | 69 if (io.Platform.isWindows) { |
| 58 home = io.Platform.environment['LOCALAPPDATA']; | 70 home = io.Platform.environment['LOCALAPPDATA']; |
| 59 } else { | 71 } else { |
| 60 home = io.Platform.environment['HOME']; | 72 home = io.Platform.environment['HOME']; |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 209 bool operator ==(other) { | 221 bool operator ==(other) { |
| 210 if (runtimeType != other.runtimeType) { | 222 if (runtimeType != other.runtimeType) { |
| 211 return false; | 223 return false; |
| 212 } | 224 } |
| 213 return path == other.path; | 225 return path == other.path; |
| 214 } | 226 } |
| 215 | 227 |
| 216 @override | 228 @override |
| 217 String toString() => path; | 229 String toString() => path; |
| 218 } | 230 } |
| OLD | NEW |