File tree Expand file tree Collapse file tree 2 files changed +11
-4
lines changed Expand file tree Collapse file tree 2 files changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -51,7 +51,7 @@ extension Driver.ErrorDiagnostics: CustomStringConvertible {
51
51
/// The Swift driver.
52
52
public struct Driver {
53
53
public enum Error : Swift . Error , Equatable , DiagnosticData {
54
- case unknownOrMissingSubcommand( String )
54
+ case unknownOrMissingSubcommand( String , String ? )
55
55
case invalidDriverName( String )
56
56
case invalidInput( String )
57
57
case noInputFiles
@@ -82,7 +82,10 @@ public struct Driver {
82
82
83
83
public var description : String {
84
84
switch self {
85
- case . unknownOrMissingSubcommand( let subcommand) :
85
+ case . unknownOrMissingSubcommand( let subcommand, let directory) :
86
+ if let directory {
87
+ return " unknown or missing subcommand ' \( subcommand) ' in ' \( directory) ' "
88
+ }
86
89
return " unknown or missing subcommand ' \( subcommand) ' "
87
90
case . invalidDriverName( let driverName) :
88
91
return " invalid driver name: \( driverName) "
Original file line number Diff line number Diff line change @@ -108,7 +108,11 @@ do {
108
108
let legacyDriverCommand = [ path] + CommandLine. arguments [ 1 ... ]
109
109
try exec ( path: path, args: legacyDriverCommand)
110
110
} else {
111
- throw Driver . Error. unknownOrMissingSubcommand ( legacyExecutablePath. lastPathComponent)
111
+ throw Driver . Error. unknownOrMissingSubcommand (
112
+ legacyExecutablePath. lastPathComponent,
113
+ legacyExecutablePath
114
+ . deletingLastPathComponent ( )
115
+ . withUnsafeFileSystemRepresentation { String ( cString: $0!) } )
112
116
}
113
117
}
114
118
127
131
128
132
guard let subcommandPath = subcommandPath,
129
133
localFileSystem. exists ( subcommandPath) else {
130
- throw Driver . Error. unknownOrMissingSubcommand ( subcommand)
134
+ throw Driver . Error. unknownOrMissingSubcommand ( subcommand, nil )
131
135
}
132
136
133
137
// Pass the full path to subcommand executable.
You can’t perform that action at this time.
0 commit comments