88#include < string.h>
99#import < Foundation/Foundation.h>
1010
11- static void parseSystemVersion (FFOSResult* os)
11+ static bool parseSystemVersion (FFOSResult* os)
1212{
1313 NSError * error;
1414 NSString * fileName = @" file:///System/Library/CoreServices/SystemVersion.plist" ;
1515 NSDictionary * dict = [NSDictionary dictionaryWithContentsOfURL: [NSURL URLWithString: fileName]
1616 error: &error];
1717 if (error)
18- return ;
18+ return false ;
1919
2020 NSString * value;
2121
@@ -30,6 +30,8 @@ static void parseSystemVersion(FFOSResult* os)
3030 // macOS 26 Tahoe. #1809
3131 os->version .chars [0 ] = ' 2' ;
3232 }
33+
34+ return true ;
3335}
3436
3537static bool detectOSCodeName (FFOSResult* os)
@@ -86,13 +88,18 @@ void ffDetectOSImpl(FFOSResult* os)
8688
8789 ffStrbufSetStatic (&os->id , " macos" );
8890
89- if (os->version .length == 0 )
91+ if (__builtin_expect (os->name .length == 0 , 0 ))
92+ ffStrbufSetStatic (&os->name , " macOS" );
93+
94+ if (__builtin_expect (os->version .length == 0 , 0 ))
9095 ffSysctlGetString (" kern.osproductversion" , &os->version );
9196
92- if (os->buildID .length == 0 )
97+ if (__builtin_expect ( os->buildID .length == 0 , 0 ) )
9398 ffSysctlGetString (" kern.osversion" , &os->buildID );
9499
95100 ffStrbufAppend (&os->versionID , &os->version );
96101
97102 detectOSCodeName (os);
103+
104+ ffStrbufSetF (&os->prettyName , " %s %s %s (%s )" , os->name .chars , os->codename .chars , os->version .chars , os->buildID .chars );
98105}
0 commit comments