Revision: 3913
          http://skim-app.svn.sourceforge.net/skim-app/?rev=3913&view=rev
Author:   hofman
Date:     2008-05-23 13:54:54 -0700 (Fri, 23 May 2008)

Log Message:
-----------
Fix getting path to template, and properly check for RTFD.

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

Modified: trunk/NSDocument_SKExtensions.m
===================================================================
--- trunk/NSDocument_SKExtensions.m     2008-05-23 17:42:13 UTC (rev 3912)
+++ trunk/NSDocument_SKExtensions.m     2008-05-23 20:54:54 UTC (rev 3913)
@@ -61,10 +61,10 @@
         else
             richTextTypes = [[NSSet alloc] initWithObjects:@"rtf", @"doc", 
nil];
     }
-    NSString *templatePath = [[NSApp delegate] 
pathForApplicationSupportFile:[templateFile stringByDeletingPathExtension] 
ofType:[templateFile pathExtension] inDirectory:@"Templates"];
-    NSString *fileType = [[templatePath pathExtension] lowercaseString];
+    NSString *fileType = [[templateFile pathExtension] lowercaseString];
     NSData *data = nil;
     if ([richTextTypes containsObject:fileType]) {
+        NSString *templatePath = [[NSApp delegate] 
pathForApplicationSupportFile:[templateFile stringByDeletingPathExtension] 
ofType:[templateFile pathExtension] inDirectory:@"Templates"];
         NSDictionary *docAttributes = nil;
         NSError *error = nil;
         NSAttributedString *templateAttrString = [[NSAttributedString alloc] 
initWithPath:templatePath documentAttributes:&docAttributes];
@@ -72,7 +72,7 @@
         data = [attrString dataFromRange:NSMakeRange(0, [attrString length]) 
documentAttributes:docAttributes error:&error];
         [templateAttrString release];
     } else if ([fileType caseInsensitiveCompare:@"rtfd"] != NSOrderedSame && 
[fileType caseInsensitiveCompare:@"odt"] != NSOrderedSame) {
-        data = [[self notesStringUsingTemplateFile:templatePath] 
dataUsingEncoding:NSUTF8StringEncoding allowLossyConversion:NO];
+        data = [[self notesStringUsingTemplateFile:templateFile] 
dataUsingEncoding:NSUTF8StringEncoding allowLossyConversion:NO];
     }
     return data;
 }

Modified: trunk/SKApplicationController.m
===================================================================
--- trunk/SKApplicationController.m     2008-05-23 17:42:13 UTC (rev 3912)
+++ trunk/SKApplicationController.m     2008-05-23 20:54:54 UTC (rev 3913)
@@ -513,9 +513,8 @@
     
     for (i = 0; fullPath == nil && i < 3; i++) {
         if (appSupportPath = [self applicationSupportPathForDomain:domains[i] 
create:NO]) {
-            if (subpath)
-                fullPath = [fullPath stringByAppendingPathComponent:subpath];
-            fullPath = [appSupportPath 
stringByAppendingPathComponent:filename];
+            fullPath = subpath ? [appSupportPath 
stringByAppendingPathComponent:subpath] : appSupportPath;
+            fullPath = [fullPath stringByAppendingPathComponent:filename];
             if ([fm fileExistsAtPath:fullPath] == NO)
                 fullPath = nil;
         }

Modified: trunk/SKPDFDocument.m
===================================================================
--- trunk/SKPDFDocument.m       2008-05-23 17:42:13 UTC (rev 3912)
+++ trunk/SKPDFDocument.m       2008-05-23 20:54:54 UTC (rev 3913)
@@ -477,7 +477,7 @@
             didWrite = [string writeToURL:absoluteURL atomically:YES 
encoding:NSISOLatin1StringEncoding error:&error];
         else 
             error = [NSError errorWithDomain:SKDocumentErrorDomain code:1 
userInfo:[NSDictionary dictionaryWithObjectsAndKeys:NSLocalizedString(@"Unable 
to write notes as FDF", @"Error description"), NSLocalizedDescriptionKey, nil]];
-    } else if ([[typeName pathExtension] caseInsensitiveCompare:@"rtfd"]) {
+    } else if ([[typeName pathExtension] caseInsensitiveCompare:@"rtfd"] == 
NSOrderedSame) {
         NSFileWrapper *fileWrapper = [self 
notesFileWrapperUsingTemplateFile:typeName];
         if (fileWrapper)
             didWrite = [fileWrapper writeToFile:[absoluteURL path] 
atomically:NO updateFilenames:NO];


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
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to