Skip to content
Snippets Groups Projects
Commit 290ef35d authored by George Nachman's avatar George Nachman
Browse files

Adhoc build 3.1.20171013_214551

parent 6b5442b3
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -187,7 +187,7 @@ DEFINE_STRING(pathsToIgnore, @"", @"Semantic History: Paths to ignore for Semant
DEFINE_BOOL(showYellowMarkForJobStoppedBySignal, YES, @"Semantic History: Use a yellow for a Shell Integration prompt mark when the job is stopped by a signal.");
 
#pragma mark - Debugging
DEFINE_BOOL(startDebugLoggingAutomatically, NO, @"Debugging: Start debug logging automatically when iTerm2 is launched.");
DEFINE_BOOL(startDebugLoggingAutomatically, YES, @"Debugging: Start debug logging automatically when iTerm2 is launched.");
DEFINE_BOOL(logDrawingPerformance, NO, @"Debugging: Log stats about text drawing performance to console.\nUsed for performance testing.");
DEFINE_BOOL(logRestorableStateSize, NO, @"Debugging: Log restorable state size info to /tmp/statesize.*.txt.");
 
Loading
Loading
Loading
Loading
@@ -2,6 +2,7 @@
// Created by George Nachman on 4/2/14.
//
 
#import "DebugLogging.h"
#import "iTermRemotePreferences.h"
#import "iTermPreferences.h"
#import "iTermWarning.h"
Loading
Loading
@@ -86,13 +87,16 @@
}
 
- (NSDictionary *)freshCopyOfRemotePreferences {
DLog(@"Getting a fresh copy of the remote prefs");
if (!self.shouldLoadRemotePrefs) {
DLog(@"remote prefs not turned on, returning nil");
return nil;
}
 
NSString *filename = [self remotePrefsLocation];
NSDictionary *remotePrefs;
if ([filename stringIsUrlLike]) {
DLog(@"Filename %@ is a url", filename);
// Download the URL's contents.
NSURL *url = [NSURL URLWithUserSuppliedString:filename];
const NSTimeInterval kFetchTimeout = 5.0;
Loading
Loading
@@ -133,6 +137,7 @@
[fileManager removeItemAtPath:tempFile error:nil];
[fileManager removeItemAtPath:tempDir error:nil];
} else {
DLog(@"Get dictionary from filename %@", filename);
remotePrefs = [NSDictionary dictionaryWithContentsOfFile:filename];
}
return remotePrefs;
Loading
Loading
@@ -214,15 +219,21 @@
}
 
- (void)copyRemotePrefsToLocalUserDefaults {
DLog(@"copy remote prefs to local");
if (_haveTriedToLoadRemotePrefs) {
DLog(@"have already tried, giving up");
return;
}
_haveTriedToLoadRemotePrefs = YES;
 
if (!self.shouldLoadRemotePrefs) {
DLog(@"remote prefs are not enabled");
return;
}
DLog(@"Go get a fresh copy of the remote prefs");
NSDictionary *remotePrefs = [self freshCopyOfRemotePreferences];
DLog(@"Got:\n%@", remotePrefs);
self.savedRemotePrefs = remotePrefs;
 
if (remotePrefs && [remotePrefs count]) {
Loading
Loading
@@ -231,18 +242,21 @@
// Empty out the current prefs
for (NSString *key in localPrefs) {
if ([self preferenceKeyIsSyncable:key]) {
DLog(@"Unset key: %@", key);
[[NSUserDefaults standardUserDefaults] removeObjectForKey:key];
}
}
 
for (NSString *key in remotePrefs) {
if ([self preferenceKeyIsSyncable:key]) {
DLog(@"Set key: %@", key);
[[NSUserDefaults standardUserDefaults] setObject:[remotePrefs objectForKey:key]
forKey:key];
}
}
return;
} else {
DLog(@"Failed to load remote prefs");
NSAlert *alert = [[[NSAlert alloc] init] autorelease];
alert.messageText = @"Failed to load preferences from custom directory. Falling back to local copy.";
alert.informativeText = [NSString stringWithFormat:@"Missing or malformed file at \"%@\"",
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment