mirror of
https://github.com/sparkle-project/Sparkle
synced 2026-11-25 04:47:55 +00:00
Restored 10.3.9 compatibility to the system version method.
This commit is contained in:
1 parent
3250e3f979
commit
66bbbedc30
5 files changed
+29
-18
No files matched your search
+1
-1
@@ -31,7 +31,7 @@
|
||||
unsigned long length = sizeof(value) ;
|
||||
|
||||
// OS version
|
||||
NSString *currentSystemVersion = SUSystemVersionString();
|
||||
NSString *currentSystemVersion = [SUUpdater systemVersionString];
|
||||
if (currentSystemVersion != nil)
|
||||
[profileArray addObject:[NSDictionary dictionaryWithObjects:[NSArray arrayWithObjects:@"osVersion",@"OS Version",currentSystemVersion,currentSystemVersion,nil] forKeys:profileDictKeys]];
|
||||
|
||||
|
||||
@@ -52,6 +52,8 @@
|
||||
// just want to call this every time the user changes the setting in the preferences.
|
||||
- (void)scheduleCheckWithInterval:(NSTimeInterval)interval;
|
||||
|
||||
+ (NSString *)systemVersionString; // Returns the current system's version.
|
||||
|
||||
@end
|
||||
|
||||
// Define some minimum intervals to avoid DOS-like checking attacks. These are in seconds.
|
||||
|
||||
+25
-2
@@ -23,7 +23,6 @@
|
||||
- (void)showUpdateErrorAlertWithInfo:(NSString *)info;
|
||||
- (void)abandonUpdate;
|
||||
- (IBAction)installAndRestart:sender;
|
||||
- (NSString *)systemVersionString;
|
||||
@end
|
||||
|
||||
@implementation SUUpdater
|
||||
@@ -214,7 +213,7 @@
|
||||
{
|
||||
// We also have to make sure that the newest version can run on the user's system.
|
||||
id <SUVersionComparison> comparator = [SUStandardVersionComparator defaultComparator];
|
||||
BOOL canRunOnCurrentSystem = ([comparator compareVersion:[updateItem minimumSystemVersion] toVersion:SUSystemVersionString()] != NSOrderedDescending);
|
||||
BOOL canRunOnCurrentSystem = ([comparator compareVersion:[updateItem minimumSystemVersion] toVersion:[SUUpdater systemVersionString]] != NSOrderedDescending);
|
||||
return (canRunOnCurrentSystem && ([comparator compareVersion:[hostBundle version] toVersion:[updateItem fileVersion]]) == NSOrderedAscending);
|
||||
}
|
||||
|
||||
@@ -614,4 +613,28 @@
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
+ (NSString *)systemVersionString
|
||||
{
|
||||
// This returns a version string of the form X.Y.Z
|
||||
// There may be a better way to deal with the problem that gestaltSystemVersionMajor
|
||||
// et al. are not defined in 10.3, but this is probably good enough.
|
||||
NSString* verStr = nil;
|
||||
#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_4
|
||||
SInt32 major, minor, bugfix;
|
||||
OSErr err1 = Gestalt(gestaltSystemVersionMajor, &major);
|
||||
OSErr err2 = Gestalt(gestaltSystemVersionMinor, &minor);
|
||||
OSErr err3 = Gestalt(gestaltSystemVersionBugFix, &bugfix);
|
||||
if (!err1 && !err2 && !err3)
|
||||
{
|
||||
verStr = [NSString stringWithFormat:@"%ld.%ld.%ld", major, minor, bugfix];
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
NSString *versionPlistPath = @"/System/Library/CoreServices/SystemVersion.plist";
|
||||
verStr = [[[NSDictionary dictionaryWithContentsOfFile:versionPlistPath] objectForKey:@"ProductVersion"] retain];
|
||||
}
|
||||
return verStr;
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -21,21 +21,6 @@
|
||||
#import "SUConstants.h"
|
||||
#endif
|
||||
|
||||
// This returns a version string of the form X.Y.Z
|
||||
static inline NSString* SUSystemVersionString(void)
|
||||
{
|
||||
SInt32 major, minor, bugfix;
|
||||
OSErr err1 = Gestalt(gestaltSystemVersionMajor, &major);
|
||||
OSErr err2 = Gestalt(gestaltSystemVersionMinor, &minor);
|
||||
OSErr err3 = Gestalt(gestaltSystemVersionBugFix, &bugfix);
|
||||
NSString* verStr = nil;
|
||||
if (!err1 && !err2 && !err3)
|
||||
{
|
||||
verStr = [NSString stringWithFormat:@"%d.%d.%d", major, minor, bugfix];
|
||||
}
|
||||
return verStr;
|
||||
}
|
||||
|
||||
|
||||
// This list should include the shared headers. It doesn't matter if some of them aren't shared (unless
|
||||
// there are name-space collisions) so we can list all of them to start with:
|
||||
|
||||
@@ -939,6 +939,7 @@
|
||||
ppc64,
|
||||
x86_64,
|
||||
);
|
||||
GCC_TREAT_WARNINGS_AS_ERRORS = YES;
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_MISSING_NEWLINE = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES;
|
||||
|
||||
Reference in new issue
Block a user