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

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

Issue 2844903002: Extend file-system abstraction with a couple methods, remove context (Closed)
Patch Set: fix test in windows bot Created 3 years, 8 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 | « pkg/front_end/lib/memory_file_system.dart ('k') | pkg/front_end/test/dependency_grapher_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 f90abc9aad16cd7fb8d723cd810d33d6d7c289c8..a81a44dfea7c9850aebde4edd92e6e6e8543aa54 100644
--- a/pkg/front_end/lib/physical_file_system.dart
+++ b/pkg/front_end/lib/physical_file_system.dart
@@ -7,8 +7,6 @@ library front_end.physical_file_system;
import 'dart:async';
import 'dart:io' as io;
-import 'package:path/path.dart' as p;
-
import 'file_system.dart';
/// Concrete implementation of [FileSystem] which performs its operations using
@@ -21,9 +19,6 @@ class PhysicalFileSystem implements FileSystem {
PhysicalFileSystem._();
@override
- p.Context get context => p.context;
-
- @override
FileSystemEntity entityForUri(Uri uri) {
if (uri.scheme != 'file' && uri.scheme != '') {
throw new ArgumentError('File URI expected');
@@ -52,4 +47,16 @@ class _PhysicalFileSystemEntity implements FileSystemEntity {
@override
Future<String> readAsString() => new io.File.fromUri(uri).readAsString();
+
+ @override
+ Future<bool> exists() async {
+ if (await io.FileSystemEntity.isFile(uri.toFilePath())) {
+ return new io.File.fromUri(uri).exists();
+ } else {
+ return new io.Directory.fromUri(uri).exists();
+ }
+ }
+
+ @override
+ Future<DateTime> lastModified() => new io.File.fromUri(uri).lastModified();
}
« no previous file with comments | « pkg/front_end/lib/memory_file_system.dart ('k') | pkg/front_end/test/dependency_grapher_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698