Revision: 4347
          http://skim-app.svn.sourceforge.net/skim-app/?rev=4347&view=rev
Author:   hofman
Date:     2008-08-04 13:11:29 +0000 (Mon, 04 Aug 2008)

Log Message:
-----------
Use CFBundleVersion for version number comparison, as it is supposed to be 
machine parseable. Add class factory method for version number.

Modified Paths:
--------------
    trunk/SKApplicationController.m
    trunk/SKVersionNumber.h
    trunk/SKVersionNumber.m

Modified: trunk/SKApplicationController.m
===================================================================
--- trunk/SKApplicationController.m     2008-08-04 11:18:33 UTC (rev 4346)
+++ trunk/SKApplicationController.m     2008-08-04 13:11:29 UTC (rev 4347)
@@ -186,10 +186,10 @@
 - (void)applicationDidFinishLaunching:(NSNotification *)aNotification{
     [NSApp setServicesProvider:self];
     
-    NSString *versionString = [[[NSBundle mainBundle] infoDictionary] 
objectForKey:@"CFBundleShortVersionString"];
-    SKVersionNumber *versionNumber = versionString ? [[[SKVersionNumber alloc] 
initWithVersionString:versionString] autorelease] : nil;
+    NSString *versionString = [[[NSBundle mainBundle] infoDictionary] 
objectForKey:(NSString *)kCFBundleVersionKey];
+    SKVersionNumber *versionNumber = versionString ? [SKVersionNumber 
versionNumberWithVersionString:versionString] : nil;
     NSString *lastVersionString = [[NSUserDefaults standardUserDefaults] 
stringForKey:SKLastVersionLaunchedKey];
-    SKVersionNumber *lastVersionNumber = lastVersionString ? 
[[[SKVersionNumber alloc] initWithVersionString:lastVersionString] autorelease] 
: nil;
+    SKVersionNumber *lastVersionNumber = lastVersionString ? [SKVersionNumber 
versionNumberWithVersionString:lastVersionString] : nil;
     if(lastVersionNumber == nil || [lastVersionNumber 
compareToVersionNumber:versionNumber] == NSOrderedAscending) {
         [self showReleaseNotes:nil];
         [[NSUserDefaults standardUserDefaults] setObject:versionString 
forKey:SKLastVersionLaunchedKey];
@@ -421,7 +421,7 @@
     NSBundle *importerBundle = [NSBundle bundleWithPath:importerPath];
     NSString *importerVersion = [importerBundle 
objectForInfoDictionaryKey:(NSString *)kCFBundleVersionKey];
     if (importerVersion) {
-        SKVersionNumber *importerVersionNumber = [[[SKVersionNumber alloc] 
initWithVersionString:importerVersion] autorelease];
+        SKVersionNumber *importerVersionNumber = [SKVersionNumber 
versionNumberWithVersionString:importerVersion];
         NSDictionary *versionInfo = [[NSUserDefaults standardUserDefaults] 
dictionaryForKey:SKSpotlightVersionInfoKey];
         
         long sysVersion;
@@ -432,7 +432,7 @@
             runImporter = YES;
         } else {
             NSString *lastImporterVersion = [versionInfo 
objectForKey:SKSpotlightLastImporterVersionKey];
-            SKVersionNumber *lastImporterVersionNumber = [[[SKVersionNumber 
alloc] initWithVersionString:lastImporterVersion] autorelease];
+            SKVersionNumber *lastImporterVersionNumber = [SKVersionNumber 
versionNumberWithVersionString:lastImporterVersion];
             
             long lastSysVersion = [[versionInfo 
objectForKey:SKSpotlightLastSysVersionKey] longValue];
             

Modified: trunk/SKVersionNumber.h
===================================================================
--- trunk/SKVersionNumber.h     2008-08-04 11:18:33 UTC (rev 4346)
+++ trunk/SKVersionNumber.h     2008-08-04 13:11:29 UTC (rev 4347)
@@ -34,6 +34,8 @@
     int releaseType;
 }
 
++ (id)versionNumberWithVersionString:(NSString *)versionString;
+
 - (id)initWithVersionString:(NSString *)versionString;
 
 - (NSString *)originalVersionString;

Modified: trunk/SKVersionNumber.m
===================================================================
--- trunk/SKVersionNumber.m     2008-08-04 11:18:33 UTC (rev 4346)
+++ trunk/SKVersionNumber.m     2008-08-04 13:11:29 UTC (rev 4347)
@@ -18,6 +18,11 @@
 
 @implementation SKVersionNumber
 
++ (id)versionNumberWithVersionString:(NSString *)versionString;
+{
+    return [[[[self class] alloc] initWithVersionString:versionString] 
autorelease];
+}
+
 // Initializes the receiver from a string representation of a version number.  
The input string may have an optional leading 'v' or 'V' followed by a sequence 
of positive integers separated by '.'s.  Any trailing component of the input 
string that doesn't match this pattern is ignored.  If no portion of this 
string matches the pattern, nil is returned.
 - (id)initWithVersionString:(NSString *)versionString;
 {


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to