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

Unified Diff: pkg/watcher/lib/src/utils.dart

Issue 22999008: Handle watching a non-existent directory. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Revise. Created 7 years, 4 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 | « pkg/watcher/lib/src/directory_watcher.dart ('k') | pkg/watcher/test/directory_watcher_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/watcher/lib/src/utils.dart
diff --git a/pkg/watcher/lib/src/utils.dart b/pkg/watcher/lib/src/utils.dart
new file mode 100644
index 0000000000000000000000000000000000000000..319835ec944f3c955db24a0006e8f9e60cb4c54b
--- /dev/null
+++ b/pkg/watcher/lib/src/utils.dart
@@ -0,0 +1,16 @@
+// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+library watcher.utils;
+
+import 'dart:io';
+
+/// Returns `true` if [error] is a [DirectoryException] for a missing directory.
+bool isDirectoryNotFoundException(error) {
+ if (error is! DirectoryException) return false;
+
+ // See dartbug.com/12461 and tests/standalone/io/directory_error_test.dart.
+ var notFoundCode = Platform.operatingSystem == "windows" ? 3 : 2;
+ return error.osError.errorCode == notFoundCode;
+}
« no previous file with comments | « pkg/watcher/lib/src/directory_watcher.dart ('k') | pkg/watcher/test/directory_watcher_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698