Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(142)

Unified Diff: pkg/front_end/lib/physical_file_system.dart

Issue 2622423003: Simplify PhysicalFileSystem implementation. (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | pkg/front_end/test/physical_file_system_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/front_end/lib/physical_file_system.dart
diff --git a/pkg/front_end/lib/physical_file_system.dart b/pkg/front_end/lib/physical_file_system.dart
index 757eb60e834f4056ee67d0d07c6d931147be8996..f90abc9aad16cd7fb8d723cd810d33d6d7c289c8 100644
--- a/pkg/front_end/lib/physical_file_system.dart
+++ b/pkg/front_end/lib/physical_file_system.dart
@@ -28,34 +28,28 @@ class PhysicalFileSystem implements FileSystem {
if (uri.scheme != 'file' && uri.scheme != '') {
throw new ArgumentError('File URI expected');
}
- // Note: we don't have to verify that the URI's path is absolute, because
- // URIs with non-empty schemes always have absolute paths.
- var path = context.fromUri(uri);
- return new _PhysicalFileSystemEntity(
- context.normalize(context.absolute(path)));
+ return new _PhysicalFileSystemEntity(Uri.base.resolveUri(uri));
}
}
/// Concrete implementation of [FileSystemEntity] for use by
/// [PhysicalFileSystem].
class _PhysicalFileSystemEntity implements FileSystemEntity {
- final String _path;
-
- _PhysicalFileSystemEntity(this._path);
-
@override
- int get hashCode => _path.hashCode;
+ final Uri uri;
+
+ _PhysicalFileSystemEntity(this.uri);
@override
- Uri get uri => p.toUri(_path);
+ int get hashCode => uri.hashCode;
@override
bool operator ==(Object other) =>
- other is _PhysicalFileSystemEntity && other._path == _path;
+ other is _PhysicalFileSystemEntity && other.uri == uri;
@override
- Future<List<int>> readAsBytes() => new io.File(_path).readAsBytes();
+ Future<List<int>> readAsBytes() => new io.File.fromUri(uri).readAsBytes();
@override
- Future<String> readAsString() => new io.File(_path).readAsString();
+ Future<String> readAsString() => new io.File.fromUri(uri).readAsString();
}
« no previous file with comments | « no previous file | pkg/front_end/test/physical_file_system_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698