From 41beabba04c163db9bfa6c35b6924e87f997f37a Mon Sep 17 00:00:00 2001 From: Matthias Neeracher Date: Tue, 16 Aug 2011 04:16:24 +0200 Subject: [PATCH] Store size for media for safer indentification --- Medianno/MADocument.mm | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Medianno/MADocument.mm b/Medianno/MADocument.mm index 5422ba4..6bb94b0 100644 --- a/Medianno/MADocument.mm +++ b/Medianno/MADocument.mm @@ -45,10 +45,14 @@ NSManagedObjectContext *moc = [self managedObjectContext]; MAMedia * media = [NSEntityDescription insertNewObjectForEntityForName:@"MAMedia" inManagedObjectContext:moc]; NSString * path = [url path]; + NSNumber * size; + [url getResourceValue:&size forKey:NSURLFileSizeKey error:nil]; + media.media = path; media.date = [date timeIntervalSinceReferenceDate]; media.name = name; media.notes = @""; + media.size = size ? [size longLongValue] : 0; } #pragma mark Annotation management