From 999c8ce95fa362582bbba5f689b3f3092abe33c2 Mon Sep 17 00:00:00 2001 From: michael starke Date: Mon, 17 Jun 2013 21:05:21 +0200 Subject: [PATCH] Fixed #20 Now using [NSDocument fileUrl] --- MacPass/MPDocument.h | 1 - MacPass/MPDocument.m | 9 ++------- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/MacPass/MPDocument.h b/MacPass/MPDocument.h index 4ae56713..03102414 100644 --- a/MacPass/MPDocument.h +++ b/MacPass/MPDocument.h @@ -25,7 +25,6 @@ APPKIT_EXTERN NSString *const MPDocumentGroupKey; @property (assign, readonly) BOOL isProtected; @property (assign, readonly) KdbGroup *root; -@property (nonatomic, retain, readonly) NSURL *file; @property (nonatomic,retain) NSString *password; @property (nonatomic, retain) NSURL *key; @property (assign, readonly) MPDatabaseVersion version; diff --git a/MacPass/MPDocument.m b/MacPass/MPDocument.m index 28732be3..c7c7400a 100644 --- a/MacPass/MPDocument.m +++ b/MacPass/MPDocument.m @@ -30,7 +30,6 @@ NSString *const MPDocumentGroupKey = @"MPDocumentGroupKey"; @property (assign, nonatomic) BOOL isProtected; @property (retain) KdbTree *tree; -@property (retain) NSURL *file; @property (nonatomic, readonly) KdbPassword *passwordHash; @property (assign) MPDatabaseVersion version; @property (assign) BOOL isDecrypted; @@ -80,10 +79,8 @@ NSString *const MPDocumentGroupKey = @"MPDocumentGroupKey"; } - (BOOL)writeToURL:(NSURL *)url ofType:(NSString *)typeName error:(NSError **)outError { - self.file = url; - @try { - [KdbWriterFactory persist:self.tree file:[self.file path] withPassword:self.passwordHash]; + [KdbWriterFactory persist:self.tree file:[url path] withPassword:self.passwordHash]; } @catch (NSException *exception) { NSLog(@"%@", [exception description]); @@ -95,7 +92,6 @@ NSString *const MPDocumentGroupKey = @"MPDocumentGroupKey"; } - (BOOL)readFromURL:(NSURL *)url ofType:(NSString *)typeName error:(NSError **)outError { - self.file = url; self.isDecrypted = NO; return YES; } @@ -105,10 +101,9 @@ NSString *const MPDocumentGroupKey = @"MPDocumentGroupKey"; } - (BOOL)decryptWithPassword:(NSString *)password keyFileURL:(NSURL *)keyFileURL { - self.key = keyFileURL; self.password = password; @try { - self.tree = [KdbReaderFactory load:[self.file path] withPassword:self.passwordHash]; + self.tree = [KdbReaderFactory load:[[self fileURL] path] withPassword:self.passwordHash]; } @catch (NSException *exception) { NSLog(@"%@", [exception description]);