Add a check for a file size > 0 when saving bookmarks, and add some logging to try to catch the losing bookmarks problem.
git-svn-id: svn://10.0.0.236/trunk@184561 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -1712,20 +1712,19 @@ static BookmarkManager* gBookmarkManager = nil;
|
||||
BOOL success = [dict writeToFile:backupFile atomically:YES];
|
||||
if (success)
|
||||
{
|
||||
// XXX removed to measure hit on startup perf
|
||||
// long long bmFileSize = [[NSFileManager defaultManager] sizeOfFileAtPath:backupFile traverseLink:YES];
|
||||
// if (bmFileSize > 0)
|
||||
NSFileManager* fm = [NSFileManager defaultManager];
|
||||
long long bmFileSize = [fm sizeOfFileAtPath:backupFile traverseLink:YES];
|
||||
if (bmFileSize > 0)
|
||||
{
|
||||
NSFileManager* fm = [NSFileManager defaultManager];
|
||||
BOOL removedOld = [fm removeFileAtPath:stdPath handler:self]; // out with the old...
|
||||
BOOL movedNew = [fm movePath:backupFile toPath:stdPath handler:self]; // ... in with the new
|
||||
if (!removedOld || !movedNew)
|
||||
NSLog(@"writePropertyList: move failed (removed old file at %@ %d, moved new file from %@ %d",
|
||||
NSLog(@"writePropertyList: move failed (removed old file at %@ (OK %d), moved new file from %@ (OK %d)",
|
||||
stdPath, removedOld,
|
||||
backupFile, movedNew);
|
||||
}
|
||||
// else
|
||||
// NSLog(@"writePropertyList: saved bookmarks file was empty (%qi bytes))", bmFileSize);
|
||||
else
|
||||
NSLog(@"writePropertyList: saved bookmarks file was empty (%qi bytes))", bmFileSize);
|
||||
}
|
||||
else
|
||||
NSLog(@"writePropertyList: Failed to write file %@", pathToFile);
|
||||
|
||||
Reference in New Issue
Block a user