Fix glob list failure on Windows. BUG=https://code.google.com/p/dart/issues/detail?id=21622 R=nweiz@google.com Review URL: https://codereview.chromium.org//738863003 git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41811 260f80e4-7a28-3924-810f-c04153c831b5
diff --git a/pkgs/glob/lib/src/list_tree.dart b/pkgs/glob/lib/src/list_tree.dart index bf6f7a4..3667d63 100644 --- a/pkgs/glob/lib/src/list_tree.dart +++ b/pkgs/glob/lib/src/list_tree.dart
@@ -13,11 +13,13 @@ import 'stream_pool.dart'; import 'utils.dart'; -/// The errno for a file or directory not existing. -/// -/// This is consistent across platforms. +/// The errno for a file or directory not existing on Mac and Linux. const _ENOENT = 2; +/// Another errno we see on Windows when trying to list a non-existent +/// directory. +const _ENOENT_WIN = 3; + /// A structure built from a glob that efficiently lists filesystem entities /// that match that glob. /// @@ -331,7 +333,8 @@ // glob "foo/bar/*/baz" should fail if "foo/bar" doesn't exist but // succeed if "foo/bar/qux/baz" doesn't exist. return error is FileSystemException && - error.osError.errorCode == _ENOENT; + (error.osError.errorCode == _ENOENT || + error.osError.errorCode == _ENOENT_WIN); }); resultPool.add(stream); }); @@ -382,7 +385,8 @@ // that we only ignore warnings below wild cards. For example, the // glob "foo/bar/*/baz" should fail if "foo/bar" doesn't exist but // succeed if "foo/bar/qux/baz" doesn't exist. - if (error.osError.errorCode == _ENOENT) { + if (error.osError.errorCode == _ENOENT || + error.osError.errorCode == _ENOENT_WIN) { return const []; } else { rethrow;