Skip to content

Commit 66bfcb2

Browse files
committed
Judge executables with API on Windows
1 parent 9966689 commit 66bfcb2

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

Sources/Foundation/FileManager+Win32.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -711,7 +711,10 @@ extension FileManager {
711711
internal func _isExecutableFile(atPath path: String) -> Bool {
712712
var isDirectory: ObjCBool = false
713713
guard fileExists(atPath: path, isDirectory: &isDirectory) else { return false }
714-
return !isDirectory.boolValue && _isReadableFile(atPath: path)
714+
guard !isDirectory.boolValue, _isReadableFile(atPath: path) else { return false }
715+
return path.withCString(encodedAs: UTF16.self) {
716+
SaferiIsExecutableFileType($0, false)
717+
}
715718
}
716719

717720
internal func _isDeletableFile(atPath path: String) -> Bool {

0 commit comments

Comments
 (0)