Skip to content

Commit a2904a2

Browse files
modocachephausler
authored andcommitted
[NSFileManager] Cast file types as Int32 (#656)
On macOS, `DT_DIR` is imported as an `Int`. `Int` and `Int32` cannot be compared via `==`, so on macOS the comparison results in a build failure. Cast the variables to `Int32` to resolve.
1 parent aea8c0b commit a2904a2

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Foundation/NSFileManager.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -253,12 +253,12 @@ open class FileManager : NSObject {
253253
#if os(OSX) || os(iOS)
254254
let tempEntryType = entryType
255255
#elseif os(Linux) || os(Android)
256-
let tempEntryType = Int(entryType)
256+
let tempEntryType = Int32(entryType)
257257
#endif
258-
259-
if tempEntryType == Int(DT_DIR) {
258+
259+
if tempEntryType == Int32(DT_DIR) {
260260
let subPath: String = path + "/" + entryName
261-
261+
262262
let entries = try subpathsOfDirectory(atPath: subPath)
263263
contents.append(contentsOf: entries.map({file in "\(entryName)/\(file)"}))
264264
}

0 commit comments

Comments
 (0)