14
14
package import ArgumentParser
15
15
import Foundation
16
16
import ToolchainRegistry
17
+ import SwiftExtensions
17
18
18
19
import struct TSCBasic. AbsolutePath
19
20
import class TSCBasic. Process
@@ -22,6 +23,7 @@ import class TSCUtility.PercentProgressAnimation
22
23
import ArgumentParser
23
24
import Foundation
24
25
import ToolchainRegistry
26
+ import SwiftExtensions
25
27
26
28
import struct TSCBasic. AbsolutePath
27
29
import class TSCBasic. Process
@@ -172,7 +174,7 @@ package struct DiagnoseCommand: AsyncParsableCommand {
172
174
. deletingLastPathComponent ( )
173
175
. deletingLastPathComponent ( )
174
176
175
- guard let toolchain = try Toolchain ( AbsolutePath ( validating: toolchainPath. path ) ) ,
177
+ guard let toolchain = try Toolchain ( AbsolutePath ( validating: toolchainPath. filePath ) ) ,
176
178
let sourcekitd = toolchain. sourcekitd
177
179
else {
178
180
continue
@@ -223,7 +225,7 @@ package struct DiagnoseCommand: AsyncParsableCommand {
223
225
#if os(macOS)
224
226
reportProgress ( . collectingLogMessages( progress: 0 ) , message: " Collecting log messages " )
225
227
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 {
227
229
throw GenericError ( " Failed to create log.txt " )
228
230
}
229
231
let fileHandle = try FileHandle ( forWritingTo: outputFileUrl)
@@ -316,7 +318,7 @@ package struct DiagnoseCommand: AsyncParsableCommand {
316
318
@MainActor
317
319
private func addSwiftVersion( toBundle bundlePath: URL ) async throws {
318
320
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 {
320
322
throw GenericError ( " Failed to create file at \( outputFileUrl) " )
321
323
}
322
324
let fileHandle = try FileHandle ( forWritingTo: outputFileUrl)
@@ -333,9 +335,9 @@ package struct DiagnoseCommand: AsyncParsableCommand {
333
335
continue
334
336
}
335
337
336
- try fileHandle. write ( contentsOf: " \( swiftUrl. path ) --version \n " . data ( using: . utf8) !)
338
+ try fileHandle. write ( contentsOf: " \( swiftUrl. filePath ) --version \n " . data ( using: . utf8) !)
337
339
let process = Process (
338
- arguments: [ swiftUrl. path , " --version " ] ,
340
+ arguments: [ try swiftUrl. filePath , " --version " ] ,
339
341
outputRedirection: . stream(
340
342
stdout: { try ? fileHandle. write ( contentsOf: $0) } ,
341
343
stderr: { _ in }
@@ -417,7 +419,7 @@ package struct DiagnoseCommand: AsyncParsableCommand {
417
419
Bundle created.
418
420
When filing an issue at https://github.com/swiftlang/sourcekit-lsp/issues/new,
419
421
please attach the bundle located at
420
- \( bundlePath. path )
422
+ \( try bundlePath. filePath )
421
423
"""
422
424
)
423
425
@@ -428,7 +430,7 @@ package struct DiagnoseCommand: AsyncParsableCommand {
428
430
// is responsible for showing the diagnose bundle location to the user
429
431
if self . bundleOutputPath == nil {
430
432
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 )
432
434
} catch {
433
435
// If revealing the bundle in Finder should fail, we don't care. We still printed the bundle path to stdout.
434
436
}
0 commit comments