diff --git a/Classes/Library/TLOFileLogger.m b/Classes/Library/TLOFileLogger.m index 42d1894085..6aed404f2b 100755 --- a/Classes/Library/TLOFileLogger.m +++ b/Classes/Library/TLOFileLogger.m @@ -179,7 +179,7 @@ - (void)updatePropertyListCache /* @private */ // ---- // - NSString *writeError; + NSString *parseError; #ifdef DEBUG NSPropertyListFormat format = NSPropertyListXMLFormat_v1_0; @@ -189,18 +189,22 @@ - (void)updatePropertyListCache /* @private */ NSData *plist = [NSPropertyListSerialization dataFromPropertyList:propertyList format:format - errorDescription:&writeError]; + errorDescription:&parseError]; // ---- // - if (NSObjectIsEmpty(plist) || writeError) { - LogToConsole(@"Error Creating Property List: %@", writeError); + if (NSObjectIsEmpty(plist) || parseError) { + LogToConsole(@"Error Creating Property List: %@", parseError); } else { - [_NSFileManager() createFileAtPath:self.filename - contents:plist - attributes:nil]; + NSError *dataWriteError; - [_temporaryPropertyListItems removeAllObjects]; + [plist writeToFile:self.filename options:0 error:&dataWriteError]; + + if (dataWriteError) { + LogToConsole(@"Error Writing Property List: %@", [dataWriteError localizedDescription]); + + [_temporaryPropertyListItems removeAllObjects]; + } } } } @@ -208,19 +212,35 @@ - (void)updatePropertyListCache /* @private */ - (NSDictionary *)propertyList /* @private */ { if (self.writePlainText == NO) { - NSData *rawData = [_NSFileManager() contentsAtPath:self.filename]; - if (PointerIsEmpty(rawData) || rawData.length == 0) + NSError *readError; + + NSData *rawData = [NSString stringWithContentsOfFile:self.filename + encoding:NSUTF8StringEncoding + error:&readError]; + + if (readError) { + LogToConsole(@"Error Reading Property List: %@", [readError localizedDescription]); + return [NSDictionary dictionary]; + } + + // ---- // + + if (NSObjectIsEmpty(rawData)) { + return [NSDictionary dictionary]; + } + + // ---- // - NSString *readError; + NSString *parseError; NSDictionary *plist = [NSPropertyListSerialization propertyListFromData:rawData mutabilityOption:NSPropertyListImmutable format:NULL - errorDescription:&readError]; + errorDescription:&parseError]; if (readError) { - DebugLogToConsole(@"Error Reading Property List: %@", readError); + DebugLogToConsole(@"Error Reading Property List: %@", parseError); } else { return plist; } diff --git a/Resources/Info.plist b/Resources/Info.plist index 40b8415612..53f1bfa3af 100755 --- a/Resources/Info.plist +++ b/Resources/Info.plist @@ -47,8 +47,8 @@ TXBundleBuildCodeName Turtle Soup TXBundleBuildNumber - 12346 + 12347 TXBundleBuildReference - 2.1.1p3-305-g84bd6f4-appstore + 2.1.1p3-308-gf65a2bc-stdbuild