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

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

Issue 2391883002: MemoryResourceProvider always uses the current platform (Closed)
Patch Set: Created 4 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | pkg/analyzer/test/embedder_tests.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/file_system/memory_file_system.dart
diff --git a/pkg/analyzer/lib/file_system/memory_file_system.dart b/pkg/analyzer/lib/file_system/memory_file_system.dart
index 7dd097c849833c140c8f28b85c690f66c6ee1336..8d50f46073c56e0e613d34b1bfc78be2e1761810 100644
--- a/pkg/analyzer/lib/file_system/memory_file_system.dart
+++ b/pkg/analyzer/lib/file_system/memory_file_system.dart
@@ -13,7 +13,7 @@ import 'package:analyzer/file_system/file_system.dart';
import 'package:analyzer/src/generated/source_io.dart';
import 'package:analyzer/src/source/source_resource.dart';
import 'package:analyzer/src/util/absolute_path.dart';
-import 'package:path/path.dart';
+import 'package:path/path.dart' as pathos;
import 'package:watcher/watcher.dart';
/**
@@ -29,17 +29,18 @@ class MemoryResourceProvider implements ResourceProvider {
new HashMap<String, List<StreamController<WatchEvent>>>();
int nextStamp = 0;
- final Context _pathContext;
+ final pathos.Context _pathContext;
@override
final AbsolutePathContext absolutePathContext;
- MemoryResourceProvider({bool isWindows: false})
- : _pathContext = isWindows ? windows : posix,
- absolutePathContext = new AbsolutePathContext(isWindows);
+ MemoryResourceProvider({pathos.Context context})
+ : _pathContext = context ?? pathos.context,
+ absolutePathContext = new AbsolutePathContext(
+ pathos.Style.platform == pathos.Style.windows);
@override
- Context get pathContext => _pathContext;
+ pathos.Context get pathContext => _pathContext;
/**
* Delete the file with the given path.
@@ -324,7 +325,8 @@ class _MemoryDummyLink extends _MemoryResource implements File {
}
@override
- Uri toUri() => new Uri.file(path, windows: _provider.pathContext == windows);
+ Uri toUri() =>
+ new Uri.file(path, windows: _provider.pathContext == pathos.windows);
@override
void writeAsBytesSync(List<int> bytes) {
@@ -399,7 +401,8 @@ class _MemoryFile extends _MemoryResource implements File {
File resolveSymbolicLinksSync() => this;
@override
- Uri toUri() => new Uri.file(path, windows: _provider.pathContext == windows);
+ Uri toUri() =>
+ new Uri.file(path, windows: _provider.pathContext == pathos.windows);
@override
void writeAsBytesSync(List<int> bytes) {
@@ -497,7 +500,7 @@ class _MemoryFolder extends _MemoryResource implements Folder {
@override
Uri toUri() =>
- new Uri.directory(path, windows: _provider.pathContext == windows);
+ new Uri.directory(path, windows: _provider.pathContext == pathos.windows);
}
/**
« no previous file with comments | « no previous file | pkg/analyzer/test/embedder_tests.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698