From 623cae262d45352bf61ef15882d5164b2ea3a197 Mon Sep 17 00:00:00 2001 From: Bibiko Date: Thu, 3 Sep 2009 09:39:37 +0000 Subject: =?UTF-8?q?=E2=80=A2=20fixed=20bug=20Save=20(the=20correct=20file?= =?UTF-8?q?=20path=20will=20be=20calculated)=20=E2=80=A2=20fixed=20bug=20f?= =?UTF-8?q?or=20Save=20As=20(suggested=20name=20is=20now=20Unicode-safe=20?= =?UTF-8?q?)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Source/TableDocument.m | 10 ++++++---- 1 file 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]; -- cgit v1.2.3