File tree Expand file tree Collapse file tree 1 file changed +12
-6
lines changed Expand file tree Collapse file tree 1 file changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -25,6 +25,7 @@ import Android
25
25
#endif
26
26
27
27
import Dispatch
28
+ import Foundation
28
29
29
30
#if os(Windows)
30
31
import WinSDK
73
74
// Fallback to legacy driver if forced to
74
75
if CommandLine . arguments. contains ( Option . disallowForwardingDriver. spelling) ||
75
76
ProcessEnv . vars [ " SWIFT_USE_OLD_DRIVER " ] != nil {
76
- if let legacyExecutablePath = Process . findExecutable ( CommandLine . arguments [ 0 ] + " -legacy-driver " ) ,
77
- localFileSystem. exists ( legacyExecutablePath) {
78
- let legacyDriverCommand = [ legacyExecutablePath. pathString] +
79
- CommandLine. arguments [ 1 ... ]
80
- try exec ( path: legacyExecutablePath. pathString, args: legacyDriverCommand)
77
+ let executable : URL = URL ( fileURLWithPath: CommandLine . arguments [ 0 ] )
78
+ let legacyExecutablePath : URL =
79
+ executable. deletingLastPathComponent ( )
80
+ . appendingPathComponent ( " \( executable. deletingPathExtension ( ) . lastPathComponent) -legacy-driver " )
81
+ . appendingPathExtension ( executable. pathExtension)
82
+ let path : String = legacyExecutablePath. withUnsafeFileSystemRepresentation { String ( cString: $0!) }
83
+
84
+ if localFileSystem. exists ( AbsolutePath ( path) ) {
85
+ let legacyDriverCommand = [ path] + CommandLine. arguments [ 1 ... ]
86
+ try exec ( path: path, args: legacyDriverCommand)
81
87
} else {
82
- throw Driver . Error. unknownOrMissingSubcommand ( CommandLine . arguments [ 0 ] + " -legacy-driver " )
88
+ throw Driver . Error. unknownOrMissingSubcommand ( legacyExecutablePath . lastPathComponent )
83
89
}
84
90
}
85
91
You can’t perform that action at this time.
0 commit comments