File tree Expand file tree Collapse file tree 1 file changed +6
-12
lines changed Expand file tree Collapse file tree 1 file changed +6
-12
lines changed Original file line number Diff line number Diff line change @@ -25,7 +25,6 @@ import Android
25
25
#endif
26
26
27
27
import Dispatch
28
- import Foundation
29
28
30
29
#if os(Windows)
31
30
import WinSDK
74
73
// Fallback to legacy driver if forced to
75
74
if CommandLine . arguments. contains ( Option . disallowForwardingDriver. spelling) ||
76
75
ProcessEnv . vars [ " SWIFT_USE_OLD_DRIVER " ] != nil {
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)
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)
87
81
} else {
88
- throw Driver . Error. unknownOrMissingSubcommand ( legacyExecutablePath . lastPathComponent )
82
+ throw Driver . Error. unknownOrMissingSubcommand ( CommandLine . arguments [ 0 ] + " -legacy-driver " )
89
83
}
90
84
}
91
85
You can’t perform that action at this time.
0 commit comments