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

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

Issue 131583003: Fix FileSystemEntity:stat to remove trailing slashes, on Windows. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 11 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 | « no previous file | no next file » | 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 d35efc5c1b264841e8cee149c91138de5d6de104..1912d61309d4a13c752300b712c313f2ca26d0e6 100644
--- a/sdk/lib/io/file_system_entity.dart
+++ b/sdk/lib/io/file_system_entity.dart
@@ -83,8 +83,12 @@ class FileStat {
* FileSystemEntityType.NOT_FOUND and the other fields invalid.
*/
static FileStat statSync(String path) {
+ // Trailing path is not supported on Windows.
+ if (Platform.isWindows) {
+ path = FileSystemEntity._trimTrailingPathSeparators(path);
+ }
var data = _statSync(path);
- if (data is Error) throw data;
+ if (data is OSError) throw data;
return new FileStat._internal(
new DateTime.fromMillisecondsSinceEpoch(data[_CHANGED_TIME] * 1000),
new DateTime.fromMillisecondsSinceEpoch(data[_MODIFIED_TIME] * 1000),
@@ -102,6 +106,10 @@ class FileStat {
* .type set to FileSystemEntityType.NOT_FOUND and the other fields invalid.
*/
static Future<FileStat> stat(String path) {
+ // Trailing path is not supported on Windows.
+ if (Platform.isWindows) {
+ path = FileSystemEntity._trimTrailingPathSeparators(path);
+ }
return _IOService.dispatch(_FILE_STAT, [path]).then((response) {
if (_isErrorResponse(response)) {
throw _exceptionFromResponse(response,
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698