1414package import ArgumentParser
1515import Foundation
1616import ToolchainRegistry
17+ import SwiftExtensions
1718
1819import struct TSCBasic. AbsolutePath
1920import class TSCBasic. Process
@@ -22,6 +23,7 @@ import class TSCUtility.PercentProgressAnimation
2223import ArgumentParser
2324import Foundation
2425import ToolchainRegistry
26+ import SwiftExtensions
2527
2628import struct TSCBasic. AbsolutePath
2729import class TSCBasic. Process
@@ -172,7 +174,7 @@ package struct DiagnoseCommand: AsyncParsableCommand {
172174 . deletingLastPathComponent ( )
173175 . deletingLastPathComponent ( )
174176
175- guard let toolchain = try Toolchain ( AbsolutePath ( validating: toolchainPath. path ) ) ,
177+ guard let toolchain = try Toolchain ( AbsolutePath ( validating: toolchainPath. filePath ) ) ,
176178 let sourcekitd = toolchain. sourcekitd
177179 else {
178180 continue
@@ -223,7 +225,7 @@ package struct DiagnoseCommand: AsyncParsableCommand {
223225 #if os(macOS)
224226 reportProgress ( . collectingLogMessages( progress: 0 ) , message: " Collecting log messages " )
225227 let outputFileUrl = bundlePath. appendingPathComponent ( " log.txt " )
226- guard FileManager . default. createFile ( atPath: outputFileUrl. path , contents: nil ) else {
228+ guard FileManager . default. createFile ( atPath: try outputFileUrl. filePath , contents: nil ) else {
227229 throw GenericError ( " Failed to create log.txt " )
228230 }
229231 let fileHandle = try FileHandle ( forWritingTo: outputFileUrl)
@@ -316,7 +318,7 @@ package struct DiagnoseCommand: AsyncParsableCommand {
316318 @MainActor
317319 private func addSwiftVersion( toBundle bundlePath: URL ) async throws {
318320 let outputFileUrl = bundlePath. appendingPathComponent ( " swift-versions.txt " )
319- guard FileManager . default. createFile ( atPath: outputFileUrl. path , contents: nil ) else {
321+ guard FileManager . default. createFile ( atPath: try outputFileUrl. filePath , contents: nil ) else {
320322 throw GenericError ( " Failed to create file at \( outputFileUrl) " )
321323 }
322324 let fileHandle = try FileHandle ( forWritingTo: outputFileUrl)
@@ -333,9 +335,9 @@ package struct DiagnoseCommand: AsyncParsableCommand {
333335 continue
334336 }
335337
336- try fileHandle. write ( contentsOf: " \( swiftUrl. path ) --version \n " . data ( using: . utf8) !)
338+ try fileHandle. write ( contentsOf: " \( swiftUrl. filePath ) --version \n " . data ( using: . utf8) !)
337339 let process = Process (
338- arguments: [ swiftUrl. path , " --version " ] ,
340+ arguments: [ try swiftUrl. filePath , " --version " ] ,
339341 outputRedirection: . stream(
340342 stdout: { try ? fileHandle. write ( contentsOf: $0) } ,
341343 stderr: { _ in }
@@ -417,7 +419,7 @@ package struct DiagnoseCommand: AsyncParsableCommand {
417419 Bundle created.
418420 When filing an issue at https://github.com/swiftlang/sourcekit-lsp/issues/new,
419421 please attach the bundle located at
420- \( bundlePath. path )
422+ \( try bundlePath. filePath )
421423 """
422424 )
423425
@@ -428,7 +430,7 @@ package struct DiagnoseCommand: AsyncParsableCommand {
428430 // is responsible for showing the diagnose bundle location to the user
429431 if self . bundleOutputPath == nil {
430432 do {
431- _ = try await Process . run ( arguments: [ " open " , " -R " , bundlePath. path ] , workingDirectory: nil )
433+ _ = try await Process . run ( arguments: [ " open " , " -R " , bundlePath. filePath ] , workingDirectory: nil )
432434 } catch {
433435 // If revealing the bundle in Finder should fail, we don't care. We still printed the bundle path to stdout.
434436 }
0 commit comments