Skip to content

Commit 39b0c7f

Browse files
committed
Efficiency improvements, fixes a typo
1 parent d989581 commit 39b0c7f

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/Common.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,12 +74,12 @@
7474
[[NSProcessInfo processInfo] environment]];
7575

7676
// Try to find highlight location
77-
NSString *highlightPath = [defaults valueForKey:@"pathHL"];
77+
NSString *highlightPath = [[defaults persistentDomainForName:myDomain] valueForKey:@"pathHL"];
7878
if (highlightPath == nil) {
7979
NSUserDefaults *userDefaults = [[NSUserDefaults alloc] init];
8080
NSData* data = runTask(@"which highlight", env, status);
8181
highlightPath = [[[[NSString alloc] initWithData: data encoding: NSUTF8StringEncoding] autorelease] stringByTrimmingCharactersInSet:[NSCharacterSet newlineCharacterSet]];
82-
if ([highlightPath hasPrefix: @"/"] && [highlightPath hasSuffix: @"highlight"]) { // i.e. highlighPath looks like the actual path
82+
if (*status == 0 && [highlightPath hasPrefix: @"/"] && [highlightPath hasSuffix: @"highlight"]) { // i.e. highlightPath looks like the actual path
8383
NSMutableDictionary *newDefaults = [NSMutableDictionary dictionaryWithObject:highlightPath forKey:@"pathHL"];
8484
[newDefaults addEntriesFromDictionary: [defaults persistentDomainForName:myDomain]];
8585
[userDefaults setPersistentDomain: newDefaults forName:myDomain];

0 commit comments

Comments
 (0)