| 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 context.directory.manager; | 5 library context.directory.manager; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:collection'; | 8 import 'dart:collection'; |
| 9 import 'dart:convert'; | 9 import 'dart:convert'; |
| 10 import 'dart:core' hide Resource; | 10 import 'dart:core' hide Resource; |
| (...skipping 1161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1172 _checkForPackagespecUpdate(path, info, info.folder); | 1172 _checkForPackagespecUpdate(path, info, info.folder); |
| 1173 _checkForAnalysisOptionsUpdate(path, info, event.type); | 1173 _checkForAnalysisOptionsUpdate(path, info, event.type); |
| 1174 } | 1174 } |
| 1175 | 1175 |
| 1176 /** | 1176 /** |
| 1177 * Determine whether the given [path], when interpreted relative to the | 1177 * Determine whether the given [path], when interpreted relative to the |
| 1178 * context root [root], contains a folder whose name starts with '.'. | 1178 * context root [root], contains a folder whose name starts with '.'. |
| 1179 */ | 1179 */ |
| 1180 bool _isContainedInDotFolder(String root, String path) { | 1180 bool _isContainedInDotFolder(String root, String path) { |
| 1181 String pathDir = absolutePathContext.dirname(path); | 1181 String pathDir = absolutePathContext.dirname(path); |
| 1182 String suffixPath = absolutePathContext.suffix(pathDir, root); | 1182 String suffixPath = absolutePathContext.suffix(root, pathDir); |
| 1183 if (suffixPath == null) { | 1183 if (suffixPath == null) { |
| 1184 return false; | 1184 return false; |
| 1185 } | 1185 } |
| 1186 for (String pathComponent in absolutePathContext.split(suffixPath)) { | 1186 for (String pathComponent in absolutePathContext.split(suffixPath)) { |
| 1187 if (pathComponent.startsWith('.') && | 1187 if (pathComponent.startsWith('.') && |
| 1188 pathComponent != '.' && | 1188 pathComponent != '.' && |
| 1189 pathComponent != '..') { | 1189 pathComponent != '..') { |
| 1190 return true; | 1190 return true; |
| 1191 } | 1191 } |
| 1192 } | 1192 } |
| (...skipping 15 matching lines...) Expand all Loading... |
| 1208 } | 1208 } |
| 1209 return path == excludedPath; | 1209 return path == excludedPath; |
| 1210 }); | 1210 }); |
| 1211 } | 1211 } |
| 1212 | 1212 |
| 1213 /** | 1213 /** |
| 1214 * Determine whether the given [path], when interpreted relative to the | 1214 * Determine whether the given [path], when interpreted relative to the |
| 1215 * context root [root], contains a 'packages' folder. | 1215 * context root [root], contains a 'packages' folder. |
| 1216 */ | 1216 */ |
| 1217 bool _isInPackagesDir(String root, String path) { | 1217 bool _isInPackagesDir(String root, String path) { |
| 1218 String suffixPath = absolutePathContext.suffix(path, root); | 1218 String suffixPath = absolutePathContext.suffix(root, path); |
| 1219 if (suffixPath == null) { | 1219 if (suffixPath == null) { |
| 1220 return false; | 1220 return false; |
| 1221 } | 1221 } |
| 1222 List<String> pathParts = absolutePathContext.split(suffixPath); | 1222 List<String> pathParts = absolutePathContext.split(suffixPath); |
| 1223 return pathParts.contains(PACKAGES_NAME); | 1223 return pathParts.contains(PACKAGES_NAME); |
| 1224 } | 1224 } |
| 1225 | 1225 |
| 1226 /** | 1226 /** |
| 1227 * Determine whether the given [path] is in the direct 'doc' folder of the | 1227 * Determine whether the given [path] is in the direct 'doc' folder of the |
| 1228 * context root [root]. | 1228 * context root [root]. |
| 1229 */ | 1229 */ |
| 1230 bool _isInTopLevelDocDir(String root, String path) { | 1230 bool _isInTopLevelDocDir(String root, String path) { |
| 1231 String suffixPath = absolutePathContext.suffix(path, root); | 1231 String suffixPath = absolutePathContext.suffix(root, path); |
| 1232 if (suffixPath == null) { | 1232 if (suffixPath == null) { |
| 1233 return false; | 1233 return false; |
| 1234 } | 1234 } |
| 1235 return suffixPath == DOC_DIR_NAME || | 1235 return suffixPath == DOC_DIR_NAME || |
| 1236 suffixPath.startsWith(DOC_DIR_NAME + absolutePathContext.separator); | 1236 suffixPath.startsWith(DOC_DIR_NAME + absolutePathContext.separator); |
| 1237 } | 1237 } |
| 1238 | 1238 |
| 1239 bool _isPackagespec(String path) => | 1239 bool _isPackagespec(String path) => |
| 1240 absolutePathContext.basename(path) == PACKAGE_SPEC_NAME; | 1240 absolutePathContext.basename(path) == PACKAGE_SPEC_NAME; |
| 1241 | 1241 |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1469 var path = resourceProvider.pathContext.fromUri(uri); | 1469 var path = resourceProvider.pathContext.fromUri(uri); |
| 1470 packageMap[name] = <Folder>[resourceProvider.getFolder(path)]; | 1470 packageMap[name] = <Folder>[resourceProvider.getFolder(path)]; |
| 1471 } | 1471 } |
| 1472 }); | 1472 }); |
| 1473 return <UriResolver>[new SdkExtUriResolver(packageMap)]; | 1473 return <UriResolver>[new SdkExtUriResolver(packageMap)]; |
| 1474 } else { | 1474 } else { |
| 1475 return const <UriResolver>[]; | 1475 return const <UriResolver>[]; |
| 1476 } | 1476 } |
| 1477 } | 1477 } |
| 1478 } | 1478 } |
| OLD | NEW |