| 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 23 matching lines...) Expand all Loading... |
| 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 @override | 43 @override |
| 44 File getFile(String path) => new _PhysicalFile(new io.File(path)); |
| 45 |
| 46 @override |
| 47 Folder getFolder(String path) => new _PhysicalFolder(new io.Directory(path)); |
| 48 |
| 49 @override |
| 44 Resource getResource(String path) { | 50 Resource getResource(String path) { |
| 45 if (io.FileSystemEntity.isDirectorySync(path)) { | 51 if (io.FileSystemEntity.isDirectorySync(path)) { |
| 46 io.Directory directory = new io.Directory(path); | 52 return getFolder(path); |
| 47 return new _PhysicalFolder(directory); | |
| 48 } else { | 53 } else { |
| 49 io.File file = new io.File(path); | 54 return getFile(path); |
| 50 return new _PhysicalFile(file); | |
| 51 } | 55 } |
| 52 } | 56 } |
| 53 | 57 |
| 54 @override | 58 @override |
| 55 Folder getStateLocation(String pluginId) { | 59 Folder getStateLocation(String pluginId) { |
| 56 String home; | 60 String home; |
| 57 if (io.Platform.isWindows) { | 61 if (io.Platform.isWindows) { |
| 58 home = io.Platform.environment['LOCALAPPDATA']; | 62 home = io.Platform.environment['LOCALAPPDATA']; |
| 59 } else { | 63 } else { |
| 60 home = io.Platform.environment['HOME']; | 64 home = io.Platform.environment['HOME']; |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 bool operator ==(other) { | 213 bool operator ==(other) { |
| 210 if (runtimeType != other.runtimeType) { | 214 if (runtimeType != other.runtimeType) { |
| 211 return false; | 215 return false; |
| 212 } | 216 } |
| 213 return path == other.path; | 217 return path == other.path; |
| 214 } | 218 } |
| 215 | 219 |
| 216 @override | 220 @override |
| 217 String toString() => path; | 221 String toString() => path; |
| 218 } | 222 } |
| OLD | NEW |