Revision: 2760
          http://skim-app.svn.sourceforge.net/skim-app/?rev=2760&view=rev
Author:   hofman
Date:     2007-08-28 14:34:36 -0700 (Tue, 28 Aug 2007)

Log Message:
-----------
Don't write empty notes from command line tool.

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

Modified: trunk/skimnotes.m
===================================================================
--- trunk/skimnotes.m   2007-08-28 20:25:21 UTC (rev 2759)
+++ trunk/skimnotes.m   2007-08-28 21:34:36 UTC (rev 2760)
@@ -129,10 +129,14 @@
         }
         if (data) {
             if ([notesPath isEqualToString:@"-"]) {
-                [(NSFileHandle *)[NSFileHandle fileHandleWithStandardOutput] 
writeData:data];
+                if ([data length])
+                    [(NSFileHandle *)[NSFileHandle 
fileHandleWithStandardOutput] writeData:data];
                 success = YES;
             } else {
-                success = [data writeToFile:notesPath atomically:YES];
+                if ([data length] || ([fm fileExistsAtPath:notesPath 
isDirectory:&isDir] && isDir == NO))
+                    success = [data writeToFile:notesPath atomically:YES];
+                else
+                    success = YES;
             }
         }
     } else if (action == SKNActionSet && notesPath && ([notesPath 
isEqualToString:@"-"] || ([fm fileExistsAtPath:notesPath isDirectory:&isDir] && 
isDir == NO))) {
@@ -144,7 +148,7 @@
             data = [NSData dataWithContentsOfFile:notesPath];
         if (data) {
             success = [fm removeExtendedAttribute:SKIM_NOTES_KEY 
atPath:pdfPath traverseLink:YES error:&error];
-            if (success || [error code] == ENOATTR)
+            if ((success || [error code] == ENOATTR) && [data length])
                 success = [fm setExtendedAttributeNamed:SKIM_NOTES_KEY 
toValue:data atPath:pdfPath options:0 error:NULL];
         }
     } else if (action == SKNActionRemove) {


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

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to