OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 analyzer.src.generated.sdk2; | 5 library analyzer.src.generated.sdk2; |
6 | 6 |
7 import 'dart:collection'; | 7 import 'dart:collection'; |
8 import 'dart:convert'; | 8 import 'dart:convert'; |
9 import 'dart:io' as io; | 9 import 'dart:io' as io; |
10 | 10 |
(...skipping 662 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
673 } | 673 } |
674 return sdkDirectory; | 674 return sdkDirectory; |
675 } | 675 } |
676 | 676 |
677 static String getSdkProperty(ResourceProvider resourceProvider) { | 677 static String getSdkProperty(ResourceProvider resourceProvider) { |
678 String exec = io.Platform.resolvedExecutable; | 678 String exec = io.Platform.resolvedExecutable; |
679 if (exec.length == 0) { | 679 if (exec.length == 0) { |
680 return null; | 680 return null; |
681 } | 681 } |
682 pathos.Context pathContext = resourceProvider.pathContext; | 682 pathos.Context pathContext = resourceProvider.pathContext; |
| 683 if (pathContext != pathos.context) { |
| 684 // The only time this will be true is if pathContext == posix and |
| 685 // pathos.context == windows, which only happens when running tests. |
| 686 if (exec.startsWith(new RegExp('[a-zA-Z]:'))) { |
| 687 exec = exec.substring(2); |
| 688 } |
| 689 exec = pathContext.fromUri(pathos.context.toUri(exec)); |
| 690 } |
683 // Might be "xcodebuild/ReleaseIA32/dart" with "sdk" sibling | 691 // Might be "xcodebuild/ReleaseIA32/dart" with "sdk" sibling |
684 String outDir = pathContext.dirname(pathContext.dirname(exec)); | 692 String outDir = pathContext.dirname(pathContext.dirname(exec)); |
685 String sdkPath = pathContext.join(pathContext.dirname(outDir), "sdk"); | 693 String sdkPath = pathContext.join(pathContext.dirname(outDir), "sdk"); |
686 if (resourceProvider.getFolder(sdkPath).exists) { | 694 if (resourceProvider.getFolder(sdkPath).exists) { |
687 return sdkPath; | 695 return sdkPath; |
688 } | 696 } |
689 // probably be "dart-sdk/bin/dart" | 697 // probably be "dart-sdk/bin/dart" |
690 return pathContext.dirname(pathContext.dirname(exec)); | 698 return pathContext.dirname(pathContext.dirname(exec)); |
691 } | 699 } |
692 } | 700 } |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
869 SdkLibrariesReader_LibraryBuilder libraryBuilder = | 877 SdkLibrariesReader_LibraryBuilder libraryBuilder = |
870 new SdkLibrariesReader_LibraryBuilder(_useDart2jsPaths); | 878 new SdkLibrariesReader_LibraryBuilder(_useDart2jsPaths); |
871 // If any syntactic errors were found then don't try to visit the AST | 879 // If any syntactic errors were found then don't try to visit the AST |
872 // structure. | 880 // structure. |
873 if (!errorListener.errorReported) { | 881 if (!errorListener.errorReported) { |
874 unit.accept(libraryBuilder); | 882 unit.accept(libraryBuilder); |
875 } | 883 } |
876 return libraryBuilder.librariesMap; | 884 return libraryBuilder.librariesMap; |
877 } | 885 } |
878 } | 886 } |
OLD | NEW |