OLD | NEW |
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 analyzer.src.generated.source_io; | 5 library analyzer.src.generated.source_io; |
6 | 6 |
7 import 'dart:collection'; | 7 import 'dart:collection'; |
8 | 8 |
9 import 'package:analyzer/exception/exception.dart'; | 9 import 'package:analyzer/exception/exception.dart'; |
10 import 'package:analyzer/src/generated/engine.dart'; | 10 import 'package:analyzer/src/generated/engine.dart'; |
11 import 'package:analyzer/src/generated/java_io.dart'; | 11 import 'package:analyzer/src/generated/java_io.dart'; |
12 import 'package:analyzer/src/generated/source.dart'; | 12 import 'package:analyzer/src/generated/source.dart'; |
| 13 import 'package:path/path.dart' as path; |
13 | 14 |
14 export 'package:analyzer/src/generated/source.dart'; | 15 export 'package:analyzer/src/generated/source.dart'; |
15 | 16 |
16 /** | 17 /** |
17 * Instances of the class [DirectoryBasedSourceContainer] represent a source con
tainer that | 18 * Instances of the class [DirectoryBasedSourceContainer] represent a source con
tainer that |
18 * contains all sources within a given directory. | 19 * contains all sources within a given directory. |
19 */ | 20 */ |
20 @deprecated | 21 @deprecated |
21 class DirectoryBasedSourceContainer implements SourceContainer { | 22 class DirectoryBasedSourceContainer implements SourceContainer { |
22 /** | 23 /** |
(...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
501 } | 502 } |
502 String rootPath = rootDir.getAbsolutePath(); | 503 String rootPath = rootDir.getAbsolutePath(); |
503 String filePath = file.getAbsolutePath(); | 504 String filePath = file.getAbsolutePath(); |
504 return filePath.startsWith("$rootPath/lib"); | 505 return filePath.startsWith("$rootPath/lib"); |
505 } | 506 } |
506 | 507 |
507 /** | 508 /** |
508 * Convert the given file path to a "file:" URI. On Windows, this transforms | 509 * Convert the given file path to a "file:" URI. On Windows, this transforms |
509 * backslashes to forward slashes. | 510 * backslashes to forward slashes. |
510 */ | 511 */ |
511 String _toFileUri(String filePath) => | 512 String _toFileUri(String filePath) => path.context.toUri(filePath).toString(); |
512 JavaFile.pathContext.toUri(filePath).toString(); | |
513 | 513 |
514 /** | 514 /** |
515 * Return `true` if the given URI is a `package` URI. | 515 * Return `true` if the given URI is a `package` URI. |
516 * | 516 * |
517 * @param uri the URI being tested | 517 * @param uri the URI being tested |
518 * @return `true` if the given URI is a `package` URI | 518 * @return `true` if the given URI is a `package` URI |
519 */ | 519 */ |
520 static bool isPackageUri(Uri uri) => PACKAGE_SCHEME == uri.scheme; | 520 static bool isPackageUri(Uri uri) => PACKAGE_SCHEME == uri.scheme; |
521 } | 521 } |
522 | 522 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
568 } | 568 } |
569 | 569 |
570 /** | 570 /** |
571 * Return `true` if the given URI is a `file` URI. | 571 * Return `true` if the given URI is a `file` URI. |
572 * | 572 * |
573 * @param uri the URI being tested | 573 * @param uri the URI being tested |
574 * @return `true` if the given URI is a `file` URI | 574 * @return `true` if the given URI is a `file` URI |
575 */ | 575 */ |
576 static bool isFileUri(Uri uri) => uri.scheme == FILE_SCHEME; | 576 static bool isFileUri(Uri uri) => uri.scheme == FILE_SCHEME; |
577 } | 577 } |
OLD | NEW |