Changeset 435

Show
Ignore:
Timestamp:
04/18/07 13:00:56 (1 year ago)
Author:
gbooker
Message:

Hooked up the updater. Seems to work (once we have an appcast there).

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/FFusionCodec.c

    r396 r435  
    136136#include <QuickTime/ComponentDispatchHelper.c> 
    137137 
     138void FFusionRunUpdateCheck() 
     139{ 
     140    CFDateRef lastRunDate = CFPreferencesCopyAppValue(CFSTR("NextRunDate"), CFSTR("org.perian.Perian")); 
     141    CFAbsoluteTime now = CFAbsoluteTimeGetCurrent(); 
     142     
     143        if (lastRunDate != nil && CFDateGetAbsoluteTime(lastRunDate) > now) 
     144        return; 
     145 
     146    if(lastRunDate != nil) 
     147        CFRelease(lastRunDate); 
     148     
     149    //Two places to check, home dir and / 
     150     
     151    CFStringRef home = (CFStringRef)NSHomeDirectory(); 
     152    CFMutableStringRef location = CFStringCreateMutableCopy(NULL, 0, home); 
     153    CFStringAppend(location, CFSTR("/Library/PreferencePanes/Perian.prefPane/Contents/Resources/PerianUpdateChecker.app")); 
     154     
     155    char fileRep[1024]; 
     156    FSRef updateCheckRef; 
     157    Boolean doCheck = FALSE; 
     158     
     159    if(CFStringGetFileSystemRepresentation(location, fileRep, 1024)) 
     160        if(FSPathMakeRef((UInt8 *)fileRep, &updateCheckRef, NULL) == noErr) 
     161            doCheck = TRUE; 
     162     
     163    CFRelease(location); 
     164    if(doCheck == FALSE) 
     165    { 
     166        CFStringRef absLocation = CFSTR("/Library/PreferencePanes/Perian.prefPane/Contents/Resources/PerianUpdateChecker.app"); 
     167        if(CFStringGetFileSystemRepresentation(absLocation, fileRep, 1024)) 
     168            if(FSPathMakeRef((UInt8 *)fileRep, &updateCheckRef, NULL) != noErr) 
     169                return;  //We have failed 
     170    } 
     171     
     172    LSOpenFSRef(&updateCheckRef, NULL);     
     173} 
     174 
    138175//--------------------------------------------------------------------------- 
    139176// Component Routines 
     
    226263            Codecprintf(glob->fileLog, "Error opening the base image decompressor! Exiting.\n"); 
    227264        } 
     265        FFusionRunUpdateCheck(); 
    228266    } 
    229267     
  • trunk/Plists/PerianUpdateChecker-Info.plist

    r379 r435  
    1010        <string>${EXECUTABLE_NAME}</string> 
    1111        <key>CFBundleIdentifier</key> 
    12         <string>org.perian.PerianUpdateChecker</string> 
     12        <string>org.perian.Perian</string> 
    1313        <key>CFBundleInfoDictionaryVersion</key> 
    1414        <string>6.0</string> 
     
    2424        <string>NSApplication</string> 
    2525        <key>UpdateFeedURL</key> 
    26         <string>http://10.42.42.11/~durin/appcast.xml</string> 
     26        <string>http://www.perian.org/appcast.xml</string> 
    2727</dict> 
    2828</plist> 
  • trunk/Update Checker Sources/UpdateCheckerAppDelegate.h

    r368 r435  
    1717#define UPDATE_URL_KEY @"UpdateFeedURL" 
    1818#define SKIPPED_VERSION_KEY @"SkippedVersion" 
     19#define TIME_INTERVAL_TIL_NEXT_RUN 7*24*60*60 
    1920 
    2021@interface UpdateCheckerAppDelegate : NSObject { 
  • trunk/Update Checker Sources/UpdateCheckerAppDelegate.m

    r368 r435  
    2929        if (lastRunDate == nil || [lastRunDate laterDate:[NSDate date]] != lastRunDate) { 
    3030                //this means we should in fact run 
    31                 [[NSUserDefaults standardUserDefaults] setObject:[NSDate date] forKey:NEXT_RUN_KEY]; 
     31                [[NSUserDefaults standardUserDefaults] setObject:[NSDate dateWithTimeIntervalSinceNow:TIME_INTERVAL_TIL_NEXT_RUN] forKey:NEXT_RUN_KEY]; 
    3232                [self doUpdateCheck]; 
    3333        } else {