| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 analyzer.src.context.context_builder; | 5 library analyzer.src.context.context_builder; |
| 6 | 6 |
| 7 import 'dart:collection'; | 7 import 'dart:collection'; |
| 8 import 'dart:core'; | 8 import 'dart:core'; |
| 9 | 9 |
| 10 import 'package:analyzer/context/declared_variables.dart'; | 10 import 'package:analyzer/context/declared_variables.dart'; |
| (...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 515 * found, starts checking parent directories for `.packages` until reaching | 515 * found, starts checking parent directories for `.packages` until reaching |
| 516 * the root directory. | 516 * the root directory. |
| 517 * | 517 * |
| 518 * Return a [File] object representing a `.packages` file if one is found, a | 518 * Return a [File] object representing a `.packages` file if one is found, a |
| 519 * [Folder] object for the `packages/` directory if that is found, or `null` | 519 * [Folder] object for the `packages/` directory if that is found, or `null` |
| 520 * if neither is found. | 520 * if neither is found. |
| 521 */ | 521 */ |
| 522 Resource _findPackagesLocation(String path) { | 522 Resource _findPackagesLocation(String path) { |
| 523 Folder folder = resourceProvider.getFolder(path); | 523 Folder folder = resourceProvider.getFolder(path); |
| 524 if (!folder.exists) { | 524 if (!folder.exists) { |
| 525 throw new ArgumentError.value(path, "path", "Directory does not exist."); | 525 return null; |
| 526 } | 526 } |
| 527 |
| 527 File checkForConfigFile(Folder folder) { | 528 File checkForConfigFile(Folder folder) { |
| 528 File file = folder.getChildAssumingFile('.packages'); | 529 File file = folder.getChildAssumingFile('.packages'); |
| 529 if (file.exists) { | 530 if (file.exists) { |
| 530 return file; | 531 return file; |
| 531 } | 532 } |
| 532 return null; | 533 return null; |
| 533 } | 534 } |
| 534 | 535 |
| 535 // Check for $cwd/.packages | 536 // Check for $cwd/.packages |
| 536 File packagesCfgFile = checkForConfigFile(folder); | 537 File packagesCfgFile = checkForConfigFile(folder); |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 704 String _readEmbedderYaml(Folder libDir) { | 705 String _readEmbedderYaml(Folder libDir) { |
| 705 File file = libDir.getChild(EMBEDDER_FILE_NAME); | 706 File file = libDir.getChild(EMBEDDER_FILE_NAME); |
| 706 try { | 707 try { |
| 707 return file.readAsStringSync(); | 708 return file.readAsStringSync(); |
| 708 } on FileSystemException { | 709 } on FileSystemException { |
| 709 // File can't be read. | 710 // File can't be read. |
| 710 return null; | 711 return null; |
| 711 } | 712 } |
| 712 } | 713 } |
| 713 } | 714 } |
| OLD | NEW |