Revision: 4450
http://skim-app.svn.sourceforge.net/skim-app/?rev=4450&view=rev
Author: hofman
Date: 2008-08-26 13:25:19 +0000 (Tue, 26 Aug 2008)
Log Message:
-----------
Don't explicitly run the Spotlight importer. This should be done automatically
by the system as of 10.4.1 as long as the mod date increases.
Modified Paths:
--------------
trunk/SKApplicationController.h
trunk/SKApplicationController.m
Modified: trunk/SKApplicationController.h
===================================================================
--- trunk/SKApplicationController.h 2008-08-25 21:27:08 UTC (rev 4449)
+++ trunk/SKApplicationController.h 2008-08-26 13:25:19 UTC (rev 4450)
@@ -62,8 +62,6 @@
- (IBAction)editBookmarks:(id)sender;
- (IBAction)openBookmark:(id)sender;
-- (void)doSpotlightImportIfNeeded;
-
- (void)saveCurrentOpenDocuments:(id)sender;
- (NSArray *)applicationSupportDirectories;
Modified: trunk/SKApplicationController.m
===================================================================
--- trunk/SKApplicationController.m 2008-08-25 21:27:08 UTC (rev 4449)
+++ trunk/SKApplicationController.m 2008-08-26 13:25:19 UTC (rev 4450)
@@ -86,11 +86,7 @@
static NSString *SKCurrentDocumentSetupKey = @"currentDocumentSetup";
-static NSString *SKSpotlightVersionInfoKey = @"SKSpotlightVersionInfo";
-static NSString *SKSpotlightLastImporterVersionKey = @"lastImporterVersion";
-static NSString *SKSpotlightLastSysVersionKey = @"lastSysVersion";
-
@implementation SKApplicationController
+ (void)initialize{
@@ -179,8 +175,6 @@
[self showReleaseNotes:nil];
[[NSUserDefaults standardUserDefaults] setObject:versionString
forKey:SKLastVersionLaunchedKey];
}
-
- [self doSpotlightImportIfNeeded];
currentDocumentsTimer = [[NSTimer scheduledTimerWithTimeInterval:60.0
target:self selector:@selector(saveCurrentOpenDocuments:) userInfo:nil
repeats:YES] retain];
@@ -397,45 +391,6 @@
}
}
-- (void)doSpotlightImportIfNeeded {
-
- // This code finds the spotlight importer and re-runs it if the importer
or app version has changed since the last time we launched.
- NSArray *pathComponents = [NSArray arrayWithObjects:[[NSBundle mainBundle]
bundlePath], @"Contents", @"Library", @"Spotlight", @"SkimImporter", nil];
- NSString *importerPath = [[NSString pathWithComponents:pathComponents]
stringByAppendingPathExtension:@"mdimporter"];
-
- NSBundle *importerBundle = [NSBundle bundleWithPath:importerPath];
- NSString *importerVersion = [importerBundle
objectForInfoDictionaryKey:(NSString *)kCFBundleVersionKey];
- if (importerVersion) {
- SKVersionNumber *importerVersionNumber = [SKVersionNumber
versionNumberWithVersionString:importerVersion];
- NSDictionary *versionInfo = [[NSUserDefaults standardUserDefaults]
dictionaryForKey:SKSpotlightVersionInfoKey];
-
- long sysVersion;
- OSStatus err = Gestalt(gestaltSystemVersion, &sysVersion);
-
- BOOL runImporter = NO;
- if ([versionInfo count] == 0) {
- runImporter = YES;
- } else {
- NSString *lastImporterVersion = [versionInfo
objectForKey:SKSpotlightLastImporterVersionKey];
- SKVersionNumber *lastImporterVersionNumber = [SKVersionNumber
versionNumberWithVersionString:lastImporterVersion];
-
- long lastSysVersion = [[versionInfo
objectForKey:SKSpotlightLastSysVersionKey] longValue];
-
- runImporter = noErr == err ? ([lastImporterVersionNumber
compareToVersionNumber:importerVersionNumber] == NSOrderedAscending ||
sysVersion > lastSysVersion) : YES;
- }
- if (runImporter) {
- NSString *mdimportPath = @"/usr/bin/mdimport";
- if ([[NSFileManager defaultManager]
isExecutableFileAtPath:mdimportPath]) {
- [NSTask launchedTaskWithLaunchPath:mdimportPath
arguments:[NSArray arrayWithObjects:@"-r", importerPath, nil]];
-
- NSDictionary *info = [NSDictionary
dictionaryWithObjectsAndKeys:[NSNumber numberWithLong:sysVersion],
SKSpotlightLastSysVersionKey, importerVersion,
SKSpotlightLastImporterVersionKey, nil];
- [[NSUserDefaults standardUserDefaults] setObject:info
forKey:SKSpotlightVersionInfoKey];
-
- } else NSLog(@"%@ not found!", mdimportPath);
- }
- }
-}
-
- (void)saveCurrentOpenDocuments:(id)sender {
[[NSUserDefaults standardUserDefaults] setObject:[[[NSDocumentController
sharedDocumentController] documents] valueForKey:SKCurrentDocumentSetupKey]
forKey:SKLastOpenFileNamesKey];
[[[NSDocumentController sharedDocumentController] documents]
makeObjectsPerformSelector:@selector(saveRecentDocumentInfo)];
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