Revision: 6578
          http://skim-app.svn.sourceforge.net/skim-app/?rev=6578&view=rev
Author:   hofman
Date:     2010-06-09 09:23:33 +0000 (Wed, 09 Jun 2010)

Log Message:
-----------
use writeSafelyToURL:... to write notes backup, this will use a temporary path 
and set file attributes

Modified Paths:
--------------
    trunk/SKMainDocument.m

Modified: trunk/SKMainDocument.m
===================================================================
--- trunk/SKMainDocument.m      2010-06-08 17:19:57 UTC (rev 6577)
+++ trunk/SKMainDocument.m      2010-06-09 09:23:33 UTC (rev 6578)
@@ -352,19 +352,10 @@
         }
         
         if (saveNotesOK) {
-            NSString *tmpPath = [NSTemporaryDirectory() 
stringByAppendingPathComponent:[[NSProcessInfo processInfo] 
globallyUniqueString]];
-            if ([[self notes] count] == 0 || [self writeToURL:[NSURL 
fileURLWithPath:tmpPath] ofType:SKNotesDocumentType error:NULL]) {
-                if (fileExists)
-                    saveNotesOK = [fm removeItemAtPath:notesPath error:NULL];
-                if ([[self notes] count]) {
-                    if (saveNotesOK == NO) {
-                        [fm removeItemAtPath:tmpPath error:NULL];
-                    } else if (saveNotesOK = [fm moveItemAtPath:tmpPath 
toPath:notesPath error:NULL]) {
-                        NSDictionary *attrs = [self 
fileAttributesToWriteToURL:[NSURL fileURLWithPath:notesPath] 
ofType:SKNotesDocumentType forSaveOperation:NSSaveToOperation 
originalContentsURL:nil error:NULL];
-                        [fm setAttributes:attrs ofItemAtPath:notesPath 
error:NULL];
-                    }
-                }
-            }
+            if ([[self notes] count] > 0)
+                saveNotesOK = [self writeSafelyToURL:[NSURL 
fileURLWithPath:notesPath] ofType:SKNotesDocumentType 
forSaveOperation:NSSaveToOperation error:NULL];
+            else if (fileExists)
+                saveNotesOK = [fm removeItemAtPath:notesPath error:NULL];
         }
     }
     


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate 
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the 
lucky parental unit.  See the prize list and enter to win: 
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to