-
Notifications
You must be signed in to change notification settings - Fork 254
Closed
Description
Description
When you use the -r option and workingDirectory.path is "/", String(path.dropFirst(workingDirectory.path.count + 1)) will remove the first character of the file path, so FileIterator returns broken URLs and swift-format can't read any file.
| ? String(path.dropFirst(workingDirectory.path.count + 1)) |
How to reproduce the issue
For instance, on wasm32-unknown-wasi, URL(fileURLWithPath: ".") will be /, so this is the problem.
And also, the issue can be reproducible on normal platforms like this:
$ pwd
/
$ ls -l | grep *.swift
.rw-r--r--. root root 12 B Thu Oct 24 02:39:39 2024 test.swift
$ swift format lint -rs .
<unknown>: error: Unable to open est.swift: file is not readable or does not existMy environment:
- Linux aarch64
- Swift 6.0 development snapshot toolchain (6.0-snapshot-2024-10-08)
Swift version 6.0.3-dev (LLVM 81a2745a5c40b5f, Swift 8f95e04bb5d9d9a) Target: aarch64-unknown-linux-gnu - swift-format bundled with the Swift toolchain
Metadata
Metadata
Assignees
Labels
No labels