| 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 // This code was auto-generated, is not intended to be edited, and is subject to | 5 // This code was auto-generated, is not intended to be edited, and is subject to |
| 6 // significant change. Please see the README file for more information. | 6 // significant change. Please see the README file for more information. |
| 7 | 7 |
| 8 library engine.source.io; | 8 library engine.source.io; |
| 9 | 9 |
| 10 import 'source.dart'; | 10 import 'source.dart'; |
| (...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 392 uri = canonicalFile.toURI(); | 392 uri = canonicalFile.toURI(); |
| 393 } | 393 } |
| 394 return new FileBasedSource.con2(uri, canonicalFile); | 394 return new FileBasedSource.con2(uri, canonicalFile); |
| 395 } | 395 } |
| 396 } | 396 } |
| 397 return new FileBasedSource.con2(uri, getCanonicalFile(_packagesDirectories[0
], pkgName, relPath)); | 397 return new FileBasedSource.con2(uri, getCanonicalFile(_packagesDirectories[0
], pkgName, relPath)); |
| 398 } | 398 } |
| 399 | 399 |
| 400 @override | 400 @override |
| 401 Uri restoreAbsolute(Source source) { | 401 Uri restoreAbsolute(Source source) { |
| 402 if (source is FileBasedSource) { | 402 String sourcePath = source.fullName; |
| 403 String sourcePath = source.file.getPath(); | 403 for (JavaFile packagesDirectory in _packagesDirectories) { |
| 404 for (JavaFile packagesDirectory in _packagesDirectories) { | 404 List<JavaFile> pkgFolders = packagesDirectory.listFiles(); |
| 405 List<JavaFile> pkgFolders = packagesDirectory.listFiles(); | 405 if (pkgFolders != null) { |
| 406 if (pkgFolders != null) { | 406 for (JavaFile pkgFolder in pkgFolders) { |
| 407 for (JavaFile pkgFolder in pkgFolders) { | 407 try { |
| 408 try { | 408 String pkgCanonicalPath = pkgFolder.getCanonicalPath(); |
| 409 String pkgCanonicalPath = pkgFolder.getCanonicalPath(); | 409 if (sourcePath.startsWith(pkgCanonicalPath)) { |
| 410 if (sourcePath.startsWith(pkgCanonicalPath)) { | 410 String relPath = sourcePath.substring(pkgCanonicalPath.length); |
| 411 String relPath = sourcePath.substring(pkgCanonicalPath.length); | 411 return parseUriWithException("$PACKAGE_SCHEME:${pkgFolder.getName(
)}$relPath"); |
| 412 return parseUriWithException("$PACKAGE_SCHEME:${pkgFolder.getNam
e()}$relPath"); | |
| 413 } | |
| 414 } catch (e) { | |
| 415 } | 412 } |
| 413 } catch (e) { |
| 416 } | 414 } |
| 417 } | 415 } |
| 418 } | 416 } |
| 419 } | 417 } |
| 420 return null; | 418 return null; |
| 421 } | 419 } |
| 422 | 420 |
| 423 /** | 421 /** |
| 424 * Answer the canonical file for the specified package. | 422 * Answer the canonical file for the specified package. |
| 425 * | 423 * |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 501 for (JavaFile dir in _relativeDirectories) { | 499 for (JavaFile dir in _relativeDirectories) { |
| 502 JavaFile file = new JavaFile.relative(dir, filePath); | 500 JavaFile file = new JavaFile.relative(dir, filePath); |
| 503 if (file.exists()) { | 501 if (file.exists()) { |
| 504 return new FileBasedSource.con2(uri, file); | 502 return new FileBasedSource.con2(uri, file); |
| 505 } | 503 } |
| 506 } | 504 } |
| 507 } | 505 } |
| 508 return null; | 506 return null; |
| 509 } | 507 } |
| 510 } | 508 } |
| OLD | NEW |