Revision: 3506
          http://skim-app.svn.sourceforge.net/skim-app/?rev=3506&view=rev
Author:   hofman
Date:     2008-03-19 12:22:40 -0700 (Wed, 19 Mar 2008)

Log Message:
-----------
Resolve aliases in path to PDF associated to a .skim file.

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

Modified: trunk/SKNotesDocument.m
===================================================================
--- trunk/SKNotesDocument.m     2008-03-19 19:04:41 UTC (rev 3505)
+++ trunk/SKNotesDocument.m     2008-03-19 19:22:40 UTC (rev 3506)
@@ -216,9 +216,15 @@
 
 - (IBAction)openPDF:(id)sender {
     NSString *path = [[self fileName] stringByReplacingPathExtension:@"pdf"];
-    NSError *error;
+    NSError *error = nil;
     if ([[NSFileManager defaultManager] fileExistsAtPath:path]) {
-        if (nil == [[NSDocumentController sharedDocumentController] 
openDocumentWithContentsOfURL:[NSURL fileURLWithPath:path] display:YES 
error:&error])
+        FSRef ref;
+        NSURL *url = nil;
+        if (noErr == FSPathMakeRef((const unsigned char *)[[path 
stringByResolvingSymlinksInPath] fileSystemRepresentation], &ref, NULL))
+            url = [(NSURL *)CFURLCreateFromFSRef(NULL, &ref) autorelease];
+        if (url == nil)
+            url = [NSURL fileURLWithPath:path];
+        if (nil == [[NSDocumentController sharedDocumentController] 
openDocumentWithContentsOfURL:url display:YES error:&error])
             [NSApp presentError:error];
     } else NSBeep();
 }


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: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Skim-app-commit mailing list
Skim-app-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to