Merge pull request #1564 from tancred/xcodecapp_sync_last_event_id_more_frequently

Make XcodeCapp synchronize file system event status more frequently.

Reviewed.
This commit is contained in:
Antoine Mercadal committed 2012-06-14 10:24:40 -07:00
commit dc68daa859
3 files changed
+25 -7

No files matched your search

+2
View File
@@ -138,4 +138,6 @@ void fsevents_callback(ConstFSEventStreamRef streamRef,
}
}
}
[xcc updateUserDefaultsWithLastEventId];
}
+2
View File
@@ -80,6 +80,8 @@ extern NSString * const XCCListeningStartNotification;
- (void)initializeEventStreamWithPath:(NSString*)aPath;
- (void)stopEventStream;
- (void)updateLastEventId:(uint64_t)eventId;
- (void)updateUserDefaultsWithLastEventId;
- (void)synchronizeUserDefaultsWithDisk;
- (void)listenProjectAtPath:(NSString *)path;
- (void)clear;
- (void)start;
+21 -7
View File
@@ -195,13 +195,8 @@ NSString * const XCCListeningStartNotification = @"XCCListeningStartNotification
*/
- (void)clear
{
if (lastEventId && [lastEventId longLongValue] != 0)
{
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
[defaults setObject:lastEventId forKey:@"lastEventId"];
[defaults synchronize];
}
[self updateUserDefaultsWithLastEventId];
[self synchronizeUserDefaultsWithDisk];
currentProjectURL = nil;
currentProjectName = nil;
[ignoredFilePaths removeAllObjects];
@@ -259,6 +254,25 @@ NSString * const XCCListeningStartNotification = @"XCCListeningStartNotification
lastEventId = [NSNumber numberWithUnsignedLongLong:eventId];
}
/*!
Updates the user defaults with the last recorded event Id.
*/
- (void)updateUserDefaultsWithLastEventId
{
if (lastEventId && [lastEventId longLongValue] != 0)
{
[[NSUserDefaults standardUserDefaults] setObject:lastEventId forKey:@"lastEventId"];
}
}
/*!
Tells the standard user defaults to synchronize with disk.
*/
- (void)synchronizeUserDefaultsWithDisk
{
[[NSUserDefaults standardUserDefaults] synchronize];
}
/*!
Run a NSTask with the given arguments
@param arguments NSArray containing the NSTask arguments