mirror of
https://github.com/sparkle-project/Sparkle
synced 2026-11-24 04:38:16 +00:00
Use new operatingSystemVersion API when available.
This commit is contained in:
1 parent
3f829bd49c
commit
f3ed1fafe3
1 file changed
+20
-2
Vendored
+20
-2
@@ -12,6 +12,17 @@
|
||||
#include <sys/mount.h> // For statfs for isRunningOnReadOnlyVolume
|
||||
#import "SULog.h"
|
||||
|
||||
#if __MAC_OS_X_VERSION_MAX_ALLOWED < 101000
|
||||
typedef struct {
|
||||
NSInteger majorVersion;
|
||||
NSInteger minorVersion;
|
||||
NSInteger patchVersion;
|
||||
} NSOperatingSystemVersion;
|
||||
@interface NSProcessInfo ()
|
||||
- (NSOperatingSystemVersion)operatingSystemVersion;
|
||||
@end
|
||||
#endif
|
||||
|
||||
@interface SUHost ()
|
||||
@property (retain, readwrite) NSBundle *bundle;
|
||||
@end
|
||||
@@ -246,8 +257,15 @@
|
||||
|
||||
+ (NSString *)systemVersionString
|
||||
{
|
||||
NSString *versionPlistPath = @"/System/Library/CoreServices/SystemVersion.plist";
|
||||
return [NSDictionary dictionaryWithContentsOfFile:versionPlistPath][@"ProductVersion"];
|
||||
#if __MAC_OS_X_VERSION_MIN_REQUIRED < 1090 // Present in 10.9 despite NS_AVAILABLE's claims
|
||||
if (![NSProcessInfo instancesRespondToSelector:@selector(operatingSystemVersion)])
|
||||
{
|
||||
NSURL *coreServices = [[NSFileManager defaultManager] URLForDirectory:NSCoreServiceDirectory inDomain:NSSystemDomainMask appropriateForURL:nil create:NO error:nil];
|
||||
return [NSDictionary dictionaryWithContentsOfURL:[coreServices URLByAppendingPathComponent:@"SystemVersion.plist"]][@"ProductVersion"];
|
||||
}
|
||||
#endif
|
||||
NSOperatingSystemVersion version = [[NSProcessInfo processInfo] operatingSystemVersion];
|
||||
return [NSString stringWithFormat:@"%ld.%ld.%ld", (long)version.majorVersion, (long)version.minorVersion, (long)version.patchVersion];
|
||||
}
|
||||
|
||||
@end
|
||||
Reference in new issue
Block a user