OLD | NEW |
---|---|
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 package_config.packages_impl; | 5 library package_config.packages_impl; |
6 | 6 |
7 import "dart:collection" show UnmodifiableMapView; | 7 import "dart:collection" show UnmodifiableMapView; |
8 import "dart:io" show Directory; | 8 import "dart:io" show Directory; |
9 import "package:path/path.dart" as path; | 9 import "package:path/path.dart" as path; |
10 import "../packages.dart"; | 10 import "../packages.dart"; |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
63 | 63 |
64 Map<String, Uri> asMap() => new UnmodifiableMapView<String, Uri>(_mapping); | 64 Map<String, Uri> asMap() => new UnmodifiableMapView<String, Uri>(_mapping); |
65 } | 65 } |
66 | 66 |
67 /// A [Packages] implementation based on a local directory. | 67 /// A [Packages] implementation based on a local directory. |
68 class FilePackagesDirectoryPackages extends _PackagesBase { | 68 class FilePackagesDirectoryPackages extends _PackagesBase { |
69 final Directory _packageDir; | 69 final Directory _packageDir; |
70 FilePackagesDirectoryPackages(this._packageDir); | 70 FilePackagesDirectoryPackages(this._packageDir); |
71 | 71 |
72 Uri _getBase(String packageName) => | 72 Uri _getBase(String packageName) => |
73 new Uri.directory(path.join(packageName,'')); | 73 new Uri.directory(path.join(_packageDir.path, packageName, '')); |
Lasse Reichstein Nielsen
2015/05/26 07:14:59
Tests found bug! Yey!
| |
74 | 74 |
75 Iterable<String> _listPackageNames() { | 75 Iterable<String> _listPackageNames() { |
76 return _packageDir.listSync() | 76 return _packageDir.listSync() |
77 .where((e) => e is Directory) | 77 .where((e) => e is Directory) |
78 .map((e) => path.basename(e.path)); | 78 .map((e) => path.basename(e.path)); |
79 } | 79 } |
80 | 80 |
81 Iterable<String> get packages { | 81 Iterable<String> get packages { |
82 return _listPackageNames(); | 82 return _listPackageNames(); |
83 } | 83 } |
(...skipping 25 matching lines...) Expand all Loading... | |
109 } | 109 } |
110 | 110 |
111 Iterable<String> get packages { | 111 Iterable<String> get packages { |
112 throw _failListingPackages(); | 112 throw _failListingPackages(); |
113 } | 113 } |
114 | 114 |
115 Map<String, Uri> asMap() { | 115 Map<String, Uri> asMap() { |
116 throw _failListingPackages(); | 116 throw _failListingPackages(); |
117 } | 117 } |
118 } | 118 } |
OLD | NEW |