Skip to content

Commit 2206894

Browse files
authored
Use access() instead of stat() to determine if the SF Pro font is installed. (#579)
This PR uses the slightly more efficient `access()` syscall to determine if SF Pro is installed on macOS. ### Checklist: - [x] Code and documentation should follow the style of the [Style Guide](https://github.com/apple/swift-testing/blob/main/Documentation/StyleGuide.md). - [x] If public symbols are renamed or modified, DocC references should be updated.
1 parent 3c2c406 commit 2206894

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

Sources/Testing/ABI/EntryPoints/EntryPoint.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -598,8 +598,7 @@ extension Event.ConsoleOutputRecorder.Options {
598598
if let environmentVariable = Environment.flag(named: "SWT_SF_SYMBOLS_ENABLED") {
599599
result.useSFSymbols = environmentVariable
600600
} else {
601-
var statStruct = stat()
602-
result.useSFSymbols = (0 == stat("/Library/Fonts/SF-Pro.ttf", &statStruct))
601+
result.useSFSymbols = (0 == access("/Library/Fonts/SF-Pro.ttf", F_OK))
603602
}
604603
#endif
605604

0 commit comments

Comments
 (0)