File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change 9
9
*/
10
10
11
11
import protocol Build. Toolchain
12
+ import struct Utility. Path
12
13
import enum Multitool. Error
13
14
import POSIX
14
15
@@ -39,10 +40,14 @@ struct UserToolchain: Toolchain {
39
40
40
41
init ( ) throws {
41
42
do {
42
- SWIFT_EXEC = try getenv ( " SWIFT_EXEC " ) ?? popen ( [ " which " , " swiftc " ] ) . chomp ( ) . abspath ( )
43
+ SWIFT_EXEC = getenv ( " SWIFT_EXEC " )
44
+ // see if user has put something earlier in the path
45
+ ?? ( try ? POSIX . popen ( [ " which " , " swiftc " ] ) ) ? . chomp ( ) . abspath ( )
46
+ // use the swiftc installed alongside ourselves
47
+ ?? Path . join ( Process . arguments [ 0 ] , " ../swiftc " ) . abspath ( )
43
48
clang = try getenv ( " CC " ) ?? popen ( [ " which " , " clang " ] ) . chomp ( ) . abspath ( )
44
49
sysroot = nil
45
- } catch is POSIX . ShellError {
50
+ } catch POSIX . Error . ExitStatus {
46
51
throw Multitool . Error. InvalidToolchain
47
52
}
48
53
guard !SWIFT_EXEC. isEmpty && !clang. isEmpty else {
You can’t perform that action at this time.
0 commit comments