Chromium Code Reviews| Index: pkg/analysis_server/lib/src/resource.dart |
| diff --git a/pkg/analysis_server/lib/src/resource.dart b/pkg/analysis_server/lib/src/resource.dart |
| index 2db8d615b1152d1cafda3c36bed5ea685c1d84f2..357ba0d23f4ec658e84cb7f0bcd68260cb684298 100644 |
| --- a/pkg/analysis_server/lib/src/resource.dart |
| +++ b/pkg/analysis_server/lib/src/resource.dart |
| @@ -100,7 +100,7 @@ abstract class _MemoryResource implements Resource { |
| get hashCode => _path.hashCode; |
| @override |
| - String get shortName => basename(_path); |
| + String get shortName => (posix as Context).basename(_path); |
|
karlklose
2014/05/27 07:57:20
Consider adding a getter
Context get context =>
|
| @override |
| String toString() => fullName; |
| @@ -181,10 +181,10 @@ class _MemoryFileSource implements Source { |
| @override |
| Source resolveRelative(Uri relativeUri) { |
| - String relativePath = fromUri(relativeUri); |
| - String folderPath = dirname(_file._path); |
| - String path = join(folderPath, relativePath); |
| - path = normalize(path); |
| + String relativePath = (posix as Context).fromUri(relativeUri); |
| + String folderPath = (posix as Context).dirname(_file._path); |
| + String path = (posix as Context).join(folderPath, relativePath); |
| + path = (posix as Context).normalize(path); |
| _MemoryFile file = new _MemoryFile(_file._provider, path); |
| return new _MemoryFileSource(file, uriKind); |
| } |
| @@ -202,9 +202,9 @@ class _MemoryFolder extends _MemoryResource implements Folder { |
| super(provider, path); |
| @override |
| Resource getChild(String relPath) { |
| - relPath = normalize(relPath); |
| - String childPath = join(_path, relPath); |
| - childPath = normalize(childPath); |
| + relPath = (posix as Context).normalize(relPath); |
| + String childPath = (posix as Context).join(_path, relPath); |
| + childPath = (posix as Context).normalize(childPath); |
| _MemoryResource resource = _provider._pathToResource[childPath]; |
| if (resource == null) { |
| resource = new _MemoryFile(_provider, childPath); |
| @@ -216,7 +216,7 @@ class _MemoryFolder extends _MemoryResource implements Folder { |
| List<Resource> getChildren() { |
| List<Resource> children = <Resource>[]; |
| _provider._pathToResource.forEach((path, resource) { |
| - if (dirname(path) == _path) { |
| + if ((posix as Context).dirname(path) == _path) { |
| children.add(resource); |
| } |
| }); |
| @@ -237,7 +237,7 @@ class MemoryResourceProvider implements ResourceProvider { |
| @override |
| Resource getResource(String path) { |
| - path = normalize(path); |
| + path = (posix as Context).normalize(path); |
| Resource resource = _pathToResource[path]; |
| if (resource == null) { |
| resource = new _MemoryFile(this, path); |
| @@ -246,7 +246,7 @@ class MemoryResourceProvider implements ResourceProvider { |
| } |
| Folder newFolder(String path) { |
| - path = normalize(path); |
| + path = (posix as Context).normalize(path); |
| if (path.isEmpty) { |
| throw new ArgumentError('Empty paths are not supported'); |
| } |
| @@ -278,8 +278,8 @@ class MemoryResourceProvider implements ResourceProvider { |
| } |
| File newFile(String path, String content) { |
| - path = normalize(path); |
| - newFolder(dirname(path)); |
| + path = (posix as Context).normalize(path); |
| + newFolder((posix as Context).dirname(path)); |
| _MemoryFile file = new _MemoryFile(this, path); |
| _pathToResource[path] = file; |
| _pathToContent[path] = content; |