Skip to content

Commit db6d6b2

Browse files
leogdionclaude
andcommitted
Fix Android compilation by excluding FileManager tests
- Wrap FileManagerTests in #if !os(Android) since FileManager extensions are disabled on Android - Update directoryExists to use url.path() method for better cross-platform compatibility Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent 6e414dc commit db6d6b2

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

Sources/BushelUtilities/Extensions/FileManager.swift

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,16 @@ public import Foundation
109109
/// - Parameter url: The URL of the directory to check.
110110
/// - Returns: A `DirectoryExists` struct indicating the existence and type of the directory.
111111
public func directoryExists(at url: URL) -> DirectoryExists {
112+
let path: String
113+
if #available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *) {
114+
path = url.path()
115+
} else {
116+
path = url.path
117+
}
118+
112119
var isDirectory: ObjCBool = false
113120
let fileExists = self.fileExists(
114-
atPath: url.path,
121+
atPath: path,
115122
isDirectory: &isDirectory
116123
)
117124

Tests/BushelFoundationTests/FileManagerTests.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
// OTHER DEALINGS IN THE SOFTWARE.
2828
//
2929

30+
#if !os(Android)
3031
import BushelFoundationWax
3132
import XCTest
3233

@@ -70,3 +71,4 @@ internal final class FileManagerTests: XCTestCase {
7071
// XCTAssertEqual(sut.directoryExists(at: fileURL), .fileExists)
7172
// }
7273
}
74+
#endif

0 commit comments

Comments
 (0)