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 {
5151/// The Swift driver.
5252public struct Driver {
5353 public enum Error : Swift . Error , Equatable , DiagnosticData {
54- case unknownOrMissingSubcommand( String )
54+ case unknownOrMissingSubcommand( String , String ? )
5555 case invalidDriverName( String )
5656 case invalidInput( String )
5757 case noInputFiles
@@ -82,7 +82,10 @@ public struct Driver {
8282
8383 public var description : String {
8484 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+ }
8689 return " unknown or missing subcommand ' \( subcommand) ' "
8790 case . invalidDriverName( let driverName) :
8891 return " invalid driver name: \( driverName) "
Original file line number Diff line number Diff line change @@ -108,7 +108,11 @@ do {
108108 let legacyDriverCommand = [ path] + CommandLine. arguments [ 1 ... ]
109109 try exec ( path: path, args: legacyDriverCommand)
110110 } 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!) } )
112116 }
113117 }
114118
127131
128132 guard let subcommandPath = subcommandPath,
129133 localFileSystem. exists ( subcommandPath) else {
130- throw Driver . Error. unknownOrMissingSubcommand ( subcommand)
134+ throw Driver . Error. unknownOrMissingSubcommand ( subcommand, nil )
131135 }
132136
133137 // Pass the full path to subcommand executable.
You can’t perform that action at this time.
0 commit comments