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

Unified Diff: sdk/lib/io/file_system_entity.dart

Issue 12850010: Add FileSystemEntity.identical, to test if two file system objects are the same. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Improve posix versions Created 7 years, 9 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 | « sdk/lib/_internal/compiler/implementation/lib/io_patch.dart ('k') | tests/standalone/io/link_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/io/file_system_entity.dart
diff --git a/sdk/lib/io/file_system_entity.dart b/sdk/lib/io/file_system_entity.dart
index e13477b1c41e5b6c11e732e01977ccaa47d985b9..8bbba182abc70e3dd1356bdaa294e3eeb9a60a00 100644
--- a/sdk/lib/io/file_system_entity.dart
+++ b/sdk/lib/io/file_system_entity.dart
@@ -35,6 +35,7 @@ abstract class FileSystemEntity {
String get path;
external static int _getType(String path, bool followLinks);
+ external static bool _identical(String file1, String file2);
static int _getTypeSync(String path, bool followLinks) {
var result = _getType(path, followLinks);
@@ -42,6 +43,12 @@ abstract class FileSystemEntity {
return result;
}
Søren Gjesse 2013/03/20 07:49:45 I think we need a doc comment here explaining exac
+ static bool identicalSync(String file1, String file2) {
Søren Gjesse 2013/03/20 07:49:45 path1 and path2?
+ var result = _identical(file1, file2);
+ _throwIfError(result, 'Error in FileSystemEntity.identical');
+ return result;
+ }
+
static FileSystemEntityType typeSync(String path, {bool followLinks: true})
=> FileSystemEntityType._lookup(_getTypeSync(path, followLinks));
@@ -57,6 +64,8 @@ abstract class FileSystemEntity {
static _throwIfError(Object result, String msg) {
if (result is OSError) {
throw new FileIOException(msg, result);
+ } else if (result is ArgumentError) {
+ throw result;
}
}
}
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/lib/io_patch.dart ('k') | tests/standalone/io/link_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698