Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Stop fixins loading when it isn't Xcode that's loading.

...and hopefully the Xcode process name will continue to be "Xcode"
across versions.
  • Loading branch information...
commit 058e0c466b549f8ea668749e6b6ce84cb46e9d4b 1 parent 49df716
@tom-seddon tom-seddon authored
Showing with 10 additions and 27 deletions.
  1. +10 −27 Shared Code/XCFixin.m
View
37 Shared Code/XCFixin.m
@@ -2,40 +2,23 @@
#import <objc/runtime.h>
-// tries to figure out (based on the main bundle path) whether the app named
-// by `appFileName' is the one that's loading.
-static BOOL IsApp(NSString *appFileName)
+BOOL XCFixinShouldLoad(void)
{
- NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
-
- NSString *bundlePath = [[NSBundle mainBundle] bundlePath];
-
- NSString *lastPathComponent = [bundlePath lastPathComponent];
+ BOOL shouldLoad = NO;
- NSComparisonResult cmpResult = [lastPathComponent compare:appFileName
- options:NSCaseInsensitiveSearch];
+ NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
- //NSLog(@"bundlePath=%@; lastPathComponent=%@; appFileName=%@; same=%d\n",bundlePath,lastPathComponent,appFileName,(int)same);
+ {
+ NSString *processName = [[NSProcessInfo processInfo] processName];
+
+ if ([processName caseInsensitiveCompare:@"xcode" ] == NSOrderedSame)
+ shouldLoad = YES;
+ }
[pool drain];
pool = nil;
- if (cmpResult != NSOrderedSame)
- return NO;
-
- return YES;
-}
-
-BOOL XCFixinShouldLoad(void)
-{
- if (IsApp(@"FileMerge.app"))
- {
- // Don't load plugins as part of opendiff; they mostly don't
- // work, and they spam stdout when running from the terminal.
- return NO;
- }
-
- return YES;
+ return shouldLoad;
}
const NSUInteger XCFixinMaxLoadAttempts = 3;
Please sign in to comment.
Something went wrong with that request. Please try again.