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

Side by Side Diff: pkg/analysis_server/lib/src/context_manager.dart

Issue 995873002: Handle IO exception in ContextManager (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 9 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library context.directory.manager; 5 library context.directory.manager;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:collection'; 8 import 'dart:collection';
9 9
10 import 'package:analysis_server/src/analysis_server.dart'; 10 import 'package:analysis_server/src/analysis_server.dart';
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after
416 List<_ContextInfo> _createContexts(Folder folder, bool withPubspecOnly) { 416 List<_ContextInfo> _createContexts(Folder folder, bool withPubspecOnly) {
417 // check whether there is a pubspec in the folder 417 // check whether there is a pubspec in the folder
418 File pubspecFile = folder.getChild(PUBSPEC_NAME); 418 File pubspecFile = folder.getChild(PUBSPEC_NAME);
419 if (pubspecFile.exists) { 419 if (pubspecFile.exists) {
420 _ContextInfo info = 420 _ContextInfo info =
421 _createContextWithSources(folder, pubspecFile, <_ContextInfo>[]); 421 _createContextWithSources(folder, pubspecFile, <_ContextInfo>[]);
422 return [info]; 422 return [info];
423 } 423 }
424 // try to find subfolders with pubspec files 424 // try to find subfolders with pubspec files
425 List<_ContextInfo> children = <_ContextInfo>[]; 425 List<_ContextInfo> children = <_ContextInfo>[];
426 for (Resource child in folder.getChildren()) { 426 try {
427 if (child is Folder) { 427 for (Resource child in folder.getChildren()) {
428 List<_ContextInfo> childContexts = _createContexts(child, true); 428 if (child is Folder) {
429 children.addAll(childContexts); 429 List<_ContextInfo> childContexts = _createContexts(child, true);
430 children.addAll(childContexts);
431 }
430 } 432 }
433 } on FileSystemException {
434 // The directory either doesn't exist or cannot be read. Either way, there
435 // are no subfolders that need to be added.
431 } 436 }
432 // no pubspec, done 437 // no pubspec, done
433 if (withPubspecOnly) { 438 if (withPubspecOnly) {
434 return children; 439 return children;
435 } 440 }
436 // OK, create a context without a pubspec 441 // OK, create a context without a pubspec
437 _createContextWithSources(folder, pubspecFile, children); 442 _createContextWithSources(folder, pubspecFile, children);
438 return children; 443 return children;
439 } 444 }
440 445
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after
748 return excludes(resource.path); 753 return excludes(resource.path);
749 } 754 }
750 755
751 /** 756 /**
752 * Returns `true` if [path] is the pubspec file of this context. 757 * Returns `true` if [path] is the pubspec file of this context.
753 */ 758 */
754 bool isPubspec(String path) { 759 bool isPubspec(String path) {
755 return path == pubspecPath; 760 return path == pubspecPath;
756 } 761 }
757 } 762 }
OLDNEW
« 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