From 6566d61233e9065d6407ff17d2e028bab09f8d5e Mon Sep 17 00:00:00 2001 From: Alex Hoppen Date: Wed, 11 Dec 2024 16:51:24 -0800 Subject: [PATCH] Fix build warning in tests --- Tests/SwiftFormatTests/Utilities/FileIteratorTests.swift | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Tests/SwiftFormatTests/Utilities/FileIteratorTests.swift b/Tests/SwiftFormatTests/Utilities/FileIteratorTests.swift index 4146ef51a..6c15e6f41 100644 --- a/Tests/SwiftFormatTests/Utilities/FileIteratorTests.swift +++ b/Tests/SwiftFormatTests/Utilities/FileIteratorTests.swift @@ -103,12 +103,14 @@ final class FileIteratorTests: XCTestCase { while !root.isRoot { root.deleteLastPathComponent() } - var rootPath = root.path #if os(Windows) && compiler(<6.1) + var rootPath = root.path if rootPath.hasPrefix("/") { // Canonicalize /C: to C: rootPath = String(rootPath.dropFirst()) } + #else + let rootPath = root.path #endif // Make sure that we don't drop the beginning of the path if we are running in root. // https://github.com/swiftlang/swift-format/issues/862