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

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

Issue 1055983003: guard against non-existant package directory (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 8 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 377 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 */ 388 */
389 UriResolver _computePackageUriResolver(Folder folder, _ContextInfo info) { 389 UriResolver _computePackageUriResolver(Folder folder, _ContextInfo info) {
390 if (info.packageRoot != null) { 390 if (info.packageRoot != null) {
391 info.packageMapInfo = null; 391 info.packageMapInfo = null;
392 JavaFile packagesDir = new JavaFile(info.packageRoot); 392 JavaFile packagesDir = new JavaFile(info.packageRoot);
393 Map<String, List<Folder>> packageMap = new Map<String, List<Folder>>(); 393 Map<String, List<Folder>> packageMap = new Map<String, List<Folder>>();
394 if (packagesDir.isDirectory()) { 394 if (packagesDir.isDirectory()) {
395 for (JavaFile file in packagesDir.listFiles()) { 395 for (JavaFile file in packagesDir.listFiles()) {
396 // Ensure symlinks in packages directory are canonicalized 396 // Ensure symlinks in packages directory are canonicalized
397 // to prevent 'type X cannot be assigned to type X' warnings 397 // to prevent 'type X cannot be assigned to type X' warnings
398 Resource res = resourceProvider.getResource(file.getCanonicalPath()); 398 String path;
399 try {
400 path = file.getCanonicalPath();
401 } catch (e, s) {
402 // Ignore packages that do not exist
403 _instrumentationService.logException(e, s);
404 continue;
405 }
406 Resource res = resourceProvider.getResource(path);
Brian Wilkerson 2015/04/24 21:43:20 Consider moving the four lines after the try-catch
399 if (res is Folder) { 407 if (res is Folder) {
400 packageMap[file.getName()] = <Folder>[res]; 408 packageMap[file.getName()] = <Folder>[res];
401 } 409 }
402 } 410 }
403 return new PackageMapUriResolver(resourceProvider, packageMap); 411 return new PackageMapUriResolver(resourceProvider, packageMap);
404 } 412 }
405 //TODO(danrubel) remove this if it will never be called 413 //TODO(danrubel) remove this if it will never be called
406 return new PackageUriResolver([packagesDir]); 414 return new PackageUriResolver([packagesDir]);
407 } else { 415 } else {
408 beginComputePackageMap(); 416 beginComputePackageMap();
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after
794 return excludes(resource.path); 802 return excludes(resource.path);
795 } 803 }
796 804
797 /** 805 /**
798 * Returns `true` if [path] is the pubspec file of this context. 806 * Returns `true` if [path] is the pubspec file of this context.
799 */ 807 */
800 bool isPubspec(String path) { 808 bool isPubspec(String path) {
801 return path == pubspecPath; 809 return path == pubspecPath;
802 } 810 }
803 } 811 }
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