Skip to content

Commit

Permalink
main Fix support for FileIterator when working directory is /
Browse files Browse the repository at this point in the history
Added an additional check that tests to see if the working directory is root.
swiftlang#862
  • Loading branch information
macshome committed Oct 25, 2024
1 parent 3ca1a18 commit a8d37ae
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Sources/SwiftFormat/Utilities/FileIterator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ public struct FileIterator: Sequence, IteratorProtocol {
// be displayed as relative paths. Otherwise, they will still be displayed as absolute
// paths.
let relativePath =
path.hasPrefix(workingDirectory.path)
path.hasPrefix(workingDirectory.path) && path.first != "/"
? String(path.dropFirst(workingDirectory.path.count + 1))
: path
output =
Expand Down

0 comments on commit a8d37ae

Please sign in to comment.