2
// SUUnarchiver_Private.m
5
// Created by Andy Matuschak on 6/17/08.
6
// Copyright 2008 Andy Matuschak. All rights reserved.
9
#import "SUUnarchiver_Private.h"
11
@implementation SUUnarchiver (Private)
13
- _initWithURL:(NSURL *)URL
15
if ((self = [super init]))
16
archiveURL = [URL copy];
26
+ (BOOL)_canUnarchiveURL:(NSURL *)URL
31
- (void)_notifyDelegateOfExtractedLength:(long)length
33
if ([delegate respondsToSelector:@selector(unarchiver:extractedLength:)])
34
[delegate unarchiver:self extractedLength:length];
37
- (void)_notifyDelegateOfSuccess
39
if ([delegate respondsToSelector:@selector(unarchiverDidFinish:)])
40
[delegate performSelector:@selector(unarchiverDidFinish:) withObject:self];
43
- (void)_notifyDelegateOfFailure
45
if ([delegate respondsToSelector:@selector(unarchiverDidFail:)])
46
[delegate performSelector:@selector(unarchiverDidFail:) withObject:self];
49
static NSMutableArray *__unarchiverImplementations;
51
+ (void)_registerImplementation:(Class)implementation
53
if (!__unarchiverImplementations)
54
__unarchiverImplementations = [[NSMutableArray array] retain];
55
[__unarchiverImplementations addObject:implementation];
58
+ (NSArray *)_unarchiverImplementations
60
//return [NSArray arrayWithObjects:NSClassFromString(@"SUPipedUnarchiver"), NSClassFromString(@"SUDiskImageUnarchiver"), nil];
61
return [NSArray arrayWithArray:__unarchiverImplementations];
66
@implementation NSURL (SUTypeDetection)
70
FSPathMakeRef((UInt8 *)[[self path] UTF8String], &fsRefToItem, NULL );
73
LSCopyItemAttribute(&fsRefToItem, kLSRolesAll, kLSItemContentType, (CFTypeRef *)(&UTI));
74
return [UTI autorelease];
77
- (BOOL)conformsToType:(NSString *)type
79
return UTTypeConformsTo((CFStringRef)[self __UTI], (CFStringRef)type);