NSFileWrapper fileAttributes
- (NSDictionary *)fileAttributes
Return Value of [NSFileWrapper fileAttributes]
File attributes, in a dictionary of the same sort as that returned by attributesOfItemAtPath:error: (NSFileManager).
NSFileWrapper fileAttributes example.
- (BOOL) contentsOfFileWrapper:(NSFileWrapper*)fileWrapper equalContentsAtPath:(NSString*)path {
NSDictionary *fileAttrs = [[NSFileManager defaultManager] attributesOfItemAtPath:path error:nil];
NSUInteger fileSize = [attrs fileSize];
NSUInteger fileWrapperSize = [fileWrapper.fileAttributes fileSize]; // Will return zero if the file wrapper hasn't been written
if (fileWrapperSize > 0 && fileSize != fileWrapperSize) return NO;
NSData *fileData = [NSData dataWithContentsOfURL:fileURL];
NSData *fileWrapperData = fileWrapper.regularFileContents;
return [fileData isEqualToData:resourceData];
}
NSDictionary *fileAttrs = [[NSFileManager defaultManager] attributesOfItemAtPath:path error:nil];
NSUInteger fileSize = [attrs fileSize];
NSUInteger fileWrapperSize = [fileWrapper.fileAttributes fileSize]; // Will return zero if the file wrapper hasn't been written
if (fileWrapperSize > 0 && fileSize != fileWrapperSize) return NO;
NSData *fileData = [NSData dataWithContentsOfURL:fileURL];
NSData *fileWrapperData = fileWrapper.regularFileContents;
return [fileData isEqualToData:resourceData];
}