diff options
author | Bibiko <bibiko@eva.mpg.de> | 2009-09-03 09:39:37 +0000 |
---|---|---|
committer | Bibiko <bibiko@eva.mpg.de> | 2009-09-03 09:39:37 +0000 |
commit | 623cae262d45352bf61ef15882d5164b2ea3a197 (patch) | |
tree | ab48db3f3aed90797e6f8adc3623489d660d8f51 | |
parent | 58547cd1044df7a4d28a6007d4ff85d7b09ca399 (diff) | |
download | sequelpro-623cae262d45352bf61ef15882d5164b2ea3a197.tar.gz sequelpro-623cae262d45352bf61ef15882d5164b2ea3a197.tar.bz2 sequelpro-623cae262d45352bf61ef15882d5164b2ea3a197.zip |
• fixed bug Save (the correct file path will be calculated)
• fixed bug for Save As (suggested name is now Unicode-safe )
-rw-r--r-- | Source/TableDocument.m | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/Source/TableDocument.m b/Source/TableDocument.m index 87f027b7..c2b7e45f 100644 --- a/Source/TableDocument.m +++ b/Source/TableDocument.m @@ -2015,7 +2015,7 @@ // Set file name if([[[self fileURL] absoluteString] length]) - filename = [[[self fileURL] absoluteString] lastPathComponent]; + filename = [[[[self fileURL] absoluteString] stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding] lastPathComponent]; else filename = [NSString stringWithFormat:@"%@", [self name]]; @@ -2103,7 +2103,9 @@ return; NSMutableDictionary *spfDocData_temp = [NSMutableDictionary dictionary]; - NSString *myFilePath = [[[self fileURL] absoluteString] stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; + + if(fileName == nil) + fileName = [[[self fileURL] absoluteString] stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; // Store save panel settings or take them from spfDocData if(!saveInBackground) { @@ -2133,7 +2135,7 @@ NSPropertyListFormat format; NSMutableDictionary *spf = [[NSMutableDictionary alloc] init]; - NSData *pData = [NSData dataWithContentsOfFile:myFilePath options:NSUncachedRead error:&readError]; + NSData *pData = [NSData dataWithContentsOfFile:fileName options:NSUncachedRead error:&readError]; [spf addEntriesFromDictionary:[NSPropertyListSerialization propertyListFromData:pData mutabilityOption:NSPropertyListImmutable format:&format errorDescription:&convError]]; @@ -2181,7 +2183,7 @@ } NSError *error = nil; - [plist writeToFile:myFilePath options:NSAtomicWrite error:&error]; + [plist writeToFile:fileName options:NSAtomicWrite error:&error]; if(error != nil){ NSAlert *errorAlert = [NSAlert alertWithError:error]; [errorAlert runModal]; |