Revision: 4583
          http://skim-app.svn.sourceforge.net/skim-app/?rev=4583&view=rev
Author:   hofman
Date:     2008-09-08 16:18:07 +0000 (Mon, 08 Sep 2008)

Log Message:
-----------
Ignore a few more POSIX errors when failing to read notes from EAs, when 
reading EAs from the file is not supported.

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

Modified: trunk/SKPDFDocument.m
===================================================================
--- trunk/SKPDFDocument.m       2008-09-08 12:09:55 UTC (rev 4582)
+++ trunk/SKPDFDocument.m       2008-09-08 16:18:07 UTC (rev 4583)
@@ -615,6 +615,13 @@
     return didRead;
 }
 
+static BOOL isIgnorablePOSIXError(NSError *error) {
+    if ([[error domain] isEqualToString:NSPOSIXErrorDomain])
+        return [error code] == ENOATTR || [error code] == ENOTSUP || [error 
code] == EINVAL || [error code] == EPERM || [error code] == EACCES;
+    else
+        return NO;
+}
+
 - (BOOL)readFromURL:(NSURL *)absoluteURL ofType:(NSString *)docType 
error:(NSError **)outError{
     BOOL didRead = NO;
     NSData *data = nil;
@@ -633,7 +640,7 @@
                 [self setNoteDicts:array];
             } else {
                 // we found no notes, see if we had an error finding notes. if 
EAs were not supported we ignore the error, as we may assume there won't be any 
notes
-                if (array == nil && [error code] != ENOTSUP && [error code] != 
ENOATTR && [error code] != EINVAL) {
+                if (array == nil && isIgnorablePOSIXError(error) == NO) {
                     NSAlert *alert = [NSAlert 
alertWithMessageText:NSLocalizedString(@"Unable to Read Notes", @"Message in 
alert dialog") 
                                                      
defaultButton:NSLocalizedString(@"No", @"Button title")
                                                    
alternateButton:NSLocalizedString(@"Yes", @"Button title")


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 the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to