diff --git a/Headers/Foundation/NSFileCoordinator.h b/Headers/Foundation/NSFileCoordinator.h index 22d7a00bf..8a47e4e2c 100644 --- a/Headers/Foundation/NSFileCoordinator.h +++ b/Headers/Foundation/NSFileCoordinator.h @@ -74,13 +74,8 @@ DEFINE_BLOCK_TYPE(GSBatchAccessorCompositeBlock, void, GSBatchAccessorCompletion @interface NSFileCoordinator : NSObject { - id _accessArbiter; - id _fileReactor; id _purposeIdentifier; - NSURL *_recentFilePresenterURL; - id _accessClaimIDOrIDs; BOOL _isCancelled; - NSMutableDictionary *_movedItems; } + (NSArray *) filePresenters; diff --git a/Source/NSFileCoordinator.m b/Source/NSFileCoordinator.m index 2b232bf1b..51443ad7e 100644 --- a/Source/NSFileCoordinator.m +++ b/Source/NSFileCoordinator.m @@ -29,9 +29,12 @@ #import #import #import +#import static NSMutableArray *__presenters = nil; static NSMutableDictionary *__presenterMap = nil; +static unsigned int __pid = 0; +static NSMutableDictionary *__presenterIdDict = nil; @implementation NSFileAccessIntent - (instancetype) init @@ -80,6 +83,7 @@ static NSMutableDictionary *__presenterMap = nil; { __presenters = [[NSMutableArray alloc] init]; __presenterMap = [[NSMutableDictionary alloc] init]; + __presenterIdDict = [[NSMutableDictionary alloc] init]; } } @@ -92,12 +96,29 @@ static NSMutableDictionary *__presenterMap = nil; { [__presenters addObject: presenter]; [__presenterMap setObject: presenter forKey: [presenter presentedItemURL]]; + [__presenterIdDict setObject: presenter forKey: [presenter purposeIdentifier]]; } + (void) removeFilePresenter: (id)presenter { [__presenters removeObject: presenter]; [__presenterMap removeObjectForKey: [presenter presentedItemURL]]; + [__presenterIdDict removeObjectForKey: [presenter purposeIdentifier]]; +} + +- (instancetype) init +{ + self = [super init]; + if(self != nil) + { + NSString *p = nil; + + __pid++; + p = [NSString stringWithFormat: @"%d",__pid]; + _purposeIdentifier = RETAIN(p); + _isCancelled = NO; + } + return self; } - (NSString *) purposeIdentifier @@ -120,6 +141,7 @@ static NSMutableDictionary *__presenterMap = nil; NSOperationQueue *q = [o presentedItemOperationQueue]; [q cancelAllOperations]; } + _isCancelled = YES; } - (void)coordinateAccessWithIntents: (NSArray *)intents