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

Unified Diff: pkg/analyzer/lib/file_system/physical_file_system.dart

Issue 2270593003: Add support for resolving symbolic links (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: comment clean-up Created 4 years, 4 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
Index: pkg/analyzer/lib/file_system/physical_file_system.dart
diff --git a/pkg/analyzer/lib/file_system/physical_file_system.dart b/pkg/analyzer/lib/file_system/physical_file_system.dart
index 9b95ce8d98762285d24a1647c398181560a04f83..b77114967a1ee5c91e87bf3bcb0034d0fdb1c3ed 100644
--- a/pkg/analyzer/lib/file_system/physical_file_system.dart
+++ b/pkg/analyzer/lib/file_system/physical_file_system.dart
@@ -129,13 +129,17 @@ class _PhysicalFile extends _PhysicalResource implements File {
@override
int get modificationStamp {
try {
- io.File file = _entry as io.File;
- return file.lastModifiedSync().millisecondsSinceEpoch;
+ return _file.lastModifiedSync().millisecondsSinceEpoch;
} on io.FileSystemException catch (exception) {
throw new FileSystemException(exception.path, exception.message);
}
}
+ /**
+ * Return the underlying file being represented by this wrapper.
+ */
+ io.File get _file => _entry as io.File;
+
@override
Source createSource([Uri uri]) {
return new FileSource(this, uri ?? pathContext.toUri(path));
@@ -149,8 +153,7 @@ class _PhysicalFile extends _PhysicalResource implements File {
@override
List<int> readAsBytesSync() {
try {
- io.File file = _entry as io.File;
- return file.readAsBytesSync();
+ return _file.readAsBytesSync();
} on io.FileSystemException catch (exception) {
throw new FileSystemException(exception.path, exception.message);
}
@@ -159,8 +162,7 @@ class _PhysicalFile extends _PhysicalResource implements File {
@override
String readAsStringSync() {
try {
- io.File file = _entry as io.File;
- return FileBasedSource.fileReadMode(file.readAsStringSync());
+ return FileBasedSource.fileReadMode(_file.readAsStringSync());
} on io.FileSystemException catch (exception) {
throw new FileSystemException(exception.path, exception.message);
}
@@ -169,9 +171,16 @@ class _PhysicalFile extends _PhysicalResource implements File {
@override
File renameSync(String newPath) {
try {
- io.File file = _entry as io.File;
- io.File newFile = file.renameSync(newPath);
- return new _PhysicalFile(newFile);
+ return new _PhysicalFile(_file.renameSync(newPath));
+ } on io.FileSystemException catch (exception) {
+ throw new FileSystemException(exception.path, exception.message);
+ }
+ }
+
+ @override
+ File resolveSymbolicLinksSync() {
+ try {
+ return new _PhysicalFile(new io.File(_file.resolveSymbolicLinksSync()));
} on io.FileSystemException catch (exception) {
throw new FileSystemException(exception.path, exception.message);
}
@@ -183,8 +192,7 @@ class _PhysicalFile extends _PhysicalResource implements File {
@override
void writeAsBytesSync(List<int> bytes) {
try {
- io.File file = _entry as io.File;
- file.writeAsBytesSync(bytes);
+ _file.writeAsBytesSync(bytes);
} on io.FileSystemException catch (exception) {
throw new FileSystemException(exception.path, exception.message);
}
@@ -193,8 +201,7 @@ class _PhysicalFile extends _PhysicalResource implements File {
@override
void writeAsStringSync(String content) {
try {
- io.File file = _entry as io.File;
- file.writeAsStringSync(content);
+ _file.writeAsStringSync(content);
} on io.FileSystemException catch (exception) {
throw new FileSystemException(exception.path, exception.message);
}
« no previous file with comments | « pkg/analyzer/lib/file_system/memory_file_system.dart ('k') | pkg/analyzer/test/file_system/memory_file_system_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698