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

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

Issue 11416197: Support Windows share paths in the Path class. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 1 month 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/io/directory_impl.dart ('k') | sdk/lib/io/path_impl.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/io/path.dart
diff --git a/sdk/lib/io/path.dart b/sdk/lib/io/path.dart
index 4061f7e88085d96ed92a15e56a0f0c8eb45fbe7c..dcf492e0d3caac55a9dcab398176d420ccd08ce5 100644
--- a/sdk/lib/io/path.dart
+++ b/sdk/lib/io/path.dart
@@ -19,9 +19,25 @@ abstract class Path {
/**
* Creates a Path from a String that uses the native filesystem's conventions.
- * On Windows, this converts '\' to '/', and adds a '/' before a drive letter.
+ *
+ * On Windows, this converts '\' to '/' and has special handling for drive
+ * letters and shares.
+ *
+ * If the path contains a drive letter a '/' is added before the drive letter.
+ *
+ * new Path.fromNative(r'c:\a\b').toString() == '/c:/a/b'
+ *
* A path starting with '/c:/' (or any other character instead of 'c') is
* treated specially. Backwards links ('..') cannot cancel the drive letter.
+ *
+ * If the path is a share path this is recorded in the Path object and
+ * maintained in operations on the Path object.
+ *
+ * var share = new Path.fromNative(r'\\share\a\b\c');
+ * share.isWindowsShare == true
+ * share.toString() == '/share/a/b/c'
+ * share.toNativePath() == r'\\share\a\b\c'
+ * share.append('final').isWindowsShare == true
*/
factory Path.fromNative(String source) => new _Path.fromNative(source);
@@ -36,6 +52,11 @@ abstract class Path {
bool get isAbsolute;
/**
+ * Is this path a Windows share path?
+ */
+ bool get isWindowsShare;
+
+ /**
* Does this path end with a path separator?
*/
bool get hasTrailingSeparator;
« no previous file with comments | « sdk/lib/io/directory_impl.dart ('k') | sdk/lib/io/path_impl.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698