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

Unified Diff: pkg/analyzer/lib/file_system/physical_file_system.dart

Issue 1444943003: Use AbsolutePathContext in Folder.contains(). (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 1 month 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
Index: pkg/analyzer/lib/file_system/physical_file_system.dart
diff --git a/pkg/analyzer/lib/file_system/physical_file_system.dart b/pkg/analyzer/lib/file_system/physical_file_system.dart
index 303d17562eaf8cfd25109ac772053eec96fb86ca..94aa7667ed9db0451806de772c3d46c58967af23 100644
--- a/pkg/analyzer/lib/file_system/physical_file_system.dart
+++ b/pkg/analyzer/lib/file_system/physical_file_system.dart
@@ -10,6 +10,7 @@ import 'dart:io' as io;
import 'package:analyzer/src/generated/java_io.dart';
import 'package:analyzer/src/generated/source_io.dart';
+import 'package:analyzer/src/util/absolute_path.dart';
import 'package:path/path.dart';
import 'package:watcher/watcher.dart';
@@ -31,6 +32,9 @@ class PhysicalResourceProvider implements ResourceProvider {
*/
static final String SERVER_DIR = ".dartServer";
+ final AbsolutePathContext absolutePathContext =
+ new AbsolutePathContext(io.Platform.pathSeparator);
+
PhysicalResourceProvider(String fileReadMode(String s)) {
if (fileReadMode != null) {
FileBasedSource.fileReadMode = fileReadMode;
@@ -129,12 +133,12 @@ class _PhysicalFolder extends _PhysicalResource implements Folder {
@override
String canonicalizePath(String relPath) {
- return normalize(join(_entry.absolute.path, relPath));
+ return normalize(join(path, relPath));
}
@override
bool contains(String path) {
- return isWithin(this.path, path);
+ return absolutePathContext.isWithin(this.path, path);
}
@override
@@ -188,6 +192,9 @@ abstract class _PhysicalResource implements Resource {
_PhysicalResource(this._entry);
+ AbsolutePathContext get absolutePathContext =>
+ PhysicalResourceProvider.INSTANCE.absolutePathContext;
+
@override
bool get exists => _entry.existsSync();
@@ -196,7 +203,7 @@ abstract class _PhysicalResource implements Resource {
@override
Folder get parent {
- String parentPath = dirname(path);
+ String parentPath = absolutePathContext.dirname(path);
if (parentPath == path) {
return null;
}
@@ -207,7 +214,7 @@ abstract class _PhysicalResource implements Resource {
String get path => _entry.absolute.path;
@override
- String get shortName => basename(path);
+ String get shortName => absolutePathContext.basename(path);
@override
bool operator ==(other) {

Powered by Google App Engine
This is Rietveld 408576698