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

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

Issue 23444037: dart:io | Change File.fullPath to FileSystemEntity.resolveSymbolicLinks. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Document resolution of link\.. on Windows. Created 7 years, 3 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: 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 0887175e859713a681c37ffc5c57d96c66a0cc3a..dee9f9eaad74478fb89c738c017e15de56f981e9 100644
--- a/sdk/lib/io/file_system_entity.dart
+++ b/sdk/lib/io/file_system_entity.dart
@@ -221,6 +221,53 @@ abstract class FileSystemEntity {
FileSystemEntity renameSync(String newPath);
/**
+ * Resolves the path of a file system object relative to the
+ * current working directory, resolving all symbolic links on
+ * the path and resolving all '..' and '.' path segments.
+ * [resolveSymbolicLinks] returns a [:Future<String>:]
+ *
+ * [resolveSymbolicLinks] uses the operating system's native filesystem api
+ * to resolve the path, using the realpath function on linux and
+ * Mac OS, and the GetFinalPathNameByHandle function on Windows.
+ * If the path does not point to an existing file system object,
+ * [resolveSymbolicLinks] completes the returned Future with an exception.
+ * The type of the exception is determined by the type of [this],
+ * so a File object gives a FileException, etc.
+ *
+ * On Windows, symbolic links are resolved to their target before applying
+ * a '..' that follows, and on other platforms, the '..' is applied to the
+ * symbolic link without resolving it. The second behavior can be emulated
+ * on Windows by processing any '..' segments before calling
+ * [resolveSymbolicLinks]. One way of doing this is with the URI class:
+ * [:new Uri.parse('.').resolveUri(new Uri.file(input)).toFilePath();],
+ * since [resolve] removes '..' segments.
+ */
+ Future<String> resolveSymbolicLinks();
Anders Johnsen 2013/09/09 12:24:48 Impl could be here, as it should do the same for F
Bill Hesse 2013/09/13 06:34:13 Done.
+
+ /**
+ * Resolves the path of a file system object relative to the
+ * current working directory, resolving all symbolic links on
+ * the path and resolving all '..' and '.' path segments.
+ *
+ * [resolveSymbolicLinksSync] uses the operating system's native
+ * filesystem api to resolve the path, using the realpath function
+ * on linux and Mac OS, and the GetFinalPathNameByHandle function on Windows.
+ * If the path does not point to an existing file system object,
+ * [resolveSymbolicLinksSync] throws an exception.
+ * The type of the exception is determined by the type of [this],
+ * so a File object gives a FileException, etc.
+ *
+ * On Windows, symbolic links are resolved to their target before applying
+ * a '..' that follows, and on other platforms, the '..' is applied to the
+ * symbolic link without resolving it. The second behavior can be emulated
+ * on Windows by processing any '..' segments before calling
+ * [resolveSymbolicLinks]. One way of doing this is with the URI class:
+ * [:new Uri.parse('.').resolveUri(new Uri.file(input)).toFilePath();],
+ * since [resolve] removes '..' segments.
+ */
+ String resolveSymbolicLinksSync();
+
+ /**
* Calls the operating system's stat() function on the [path] of this
* [FileSystemEntity]. Identical to [:FileStat.stat(this.path):].
*
@@ -316,7 +363,7 @@ abstract class FileSystemEntity {
void _deleteSync({recursive: false});
/**
- * Synchronously checks whether two paths refer to the same object in the
+ * Checks whether two paths refer to the same object in the
* file system. Returns a [:Future<bool>:] that completes with the result.
*
* Comparing a link to its target returns false, as does comparing two links

Powered by Google App Engine
This is Rietveld 408576698