Revision: 12178
http://sourceforge.net/p/skim-app/code/12178
Author: hofman
Date: 2021-03-08 18:31:00 +0000 (Mon, 08 Mar 2021)
Log Message:
-----------
Don't do explicit spotlight import, Apple should do this correctly by now.
Modified Paths:
--------------
trunk/SKApplicationController.m
Modified: trunk/SKApplicationController.m
===================================================================
--- trunk/SKApplicationController.m 2021-03-08 18:29:37 UTC (rev 12177)
+++ trunk/SKApplicationController.m 2021-03-08 18:31:00 UTC (rev 12178)
@@ -119,7 +119,6 @@
#endif
@interface SKApplicationController (SKPrivate)
-- (void)doSpotlightImportIfNeeded;
- (void)handleGetURLEvent:(NSAppleEventDescriptor *)event
withReplyEvent:(NSAppleEventDescriptor *)replyEvent;
@end
@@ -263,8 +262,6 @@
[sud setObject:versionString forKey:SKLastVersionLaunchedKey];
}
- [self doSpotlightImportIfNeeded];
-
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
[nc addObserver:self selector:@selector(registerCurrentDocuments:)
name:SKDocumentDidShowNotification object:nil];
@@ -419,44 +416,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) {
- NSDictionary *versionInfo = [[NSUserDefaults standardUserDefaults]
dictionaryForKey:SKSpotlightVersionInfoKey];
-
- // getting gestaltSystemVersion breaks on 10.10, so we simulate it
using the minor and bugfix version component
- NSOperatingSystemVersion systemVersion = [[NSProcessInfo processInfo]
operatingSystemVersion];
- NSInteger sysVersion = 0x600 + systemVersion.majorVersion * 0x100 +
systemVersion.minorVersion * 0x10 + systemVersion.patchVersion * 0x1;
-
- BOOL runImporter = NO;
- if ([versionInfo count] == 0) {
- runImporter = YES;
- } else {
- NSString *lastImporterVersion = [versionInfo
objectForKey:SKSpotlightLastImporterVersionKey];
-
- NSInteger lastSysVersion = [[versionInfo
objectForKey:SKSpotlightLastSysVersionKey] integerValue];
-
- runImporter = sysVersion > 0 ? ([SKVersionNumber
compareVersionString:lastImporterVersion toVersionString:importerVersion] ==
NSOrderedAscending || sysVersion > lastSysVersion) : YES;
- }
- if (runImporter) {
- NSString *mdimportPath = @"/usr/bin/mdimport";
- if ([[NSFileManager defaultManager]
isExecutableFileAtPath:mdimportPath]) {
- @try { [NSTask launchedTaskWithLaunchPath:mdimportPath
arguments:[NSArray arrayWithObjects:@"-r", importerPath, nil]]; }
- @catch(id exception) {}
- NSDictionary *info = [NSDictionary
dictionaryWithObjectsAndKeys:[NSNumber numberWithInteger:sysVersion],
SKSpotlightLastSysVersionKey, importerVersion,
SKSpotlightLastImporterVersionKey, nil];
- [[NSUserDefaults standardUserDefaults] setObject:info
forKey:SKSpotlightVersionInfoKey];
-
- } else NSLog(@"%@ not found!", mdimportPath);
- }
- }
-}
-
#pragma mark NSMenu Delegate
- (void)menuNeedsUpdate:(NSMenu *)menu {
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit