Revision: 6479
http://skim-app.svn.sourceforge.net/skim-app/?rev=6479&view=rev
Author: hofman
Date: 2010-04-21 17:21:04 +0000 (Wed, 21 Apr 2010)
Log Message:
-----------
macro for template folder name
Modified Paths:
--------------
trunk/NSDocument_SKExtensions.m
Modified: trunk/NSDocument_SKExtensions.m
===================================================================
--- trunk/NSDocument_SKExtensions.m 2010-04-21 11:28:38 UTC (rev 6478)
+++ trunk/NSDocument_SKExtensions.m 2010-04-21 17:21:04 UTC (rev 6479)
@@ -49,6 +49,8 @@
NSString *SKDocumentErrorDomain = @"SKDocumentErrorDomain";
+#define TEMPLATES_FOLDER_NAME @"Templates"
+
@implementation NSDocument (SKExtensions)
#pragma mark Document Setup
@@ -97,7 +99,7 @@
NSString *fileType = [[templateFile pathExtension] lowercaseString];
NSString *string = nil;
if ([richTextTypes() containsObject:fileType] == NO) {
- NSString *templatePath = [[NSFileManager defaultManager]
pathForApplicationSupportFile:[templateFile stringByDeletingPathExtension]
ofType:[templateFile pathExtension] inDirectory:@"Templates"];
+ NSString *templatePath = [[NSFileManager defaultManager]
pathForApplicationSupportFile:[templateFile stringByDeletingPathExtension]
ofType:[templateFile pathExtension] inDirectory:TEMPLATES_FOLDER_NAME];
NSError *error = nil;
NSString *templateString = [[NSString alloc]
initWithContentsOfFile:templatePath encoding:NSUTF8StringEncoding error:&error];
string = [SKTemplateParser
stringByParsingTemplateString:templateString usingObject:self];
@@ -110,7 +112,7 @@
NSString *fileType = [[templateFile pathExtension] lowercaseString];
NSData *data = nil;
if ([richTextTypes() containsObject:fileType]) {
- NSString *templatePath = [[NSFileManager defaultManager]
pathForApplicationSupportFile:[templateFile stringByDeletingPathExtension]
ofType:[templateFile pathExtension] inDirectory:@"Templates"];
+ NSString *templatePath = [[NSFileManager defaultManager]
pathForApplicationSupportFile:[templateFile stringByDeletingPathExtension]
ofType:[templateFile pathExtension] inDirectory:TEMPLATES_FOLDER_NAME];
NSDictionary *docAttributes = nil;
NSError *error = nil;
NSAttributedString *templateAttrString = [[NSAttributedString alloc]
initWithPath:templatePath documentAttributes:&docAttributes];
@@ -126,7 +128,7 @@
- (NSFileWrapper *)notesFileWrapperUsingTemplateFile:(NSString *)templateFile {
NSFileWrapper *fileWrapper = nil;
if ([[templateFile pathExtension] caseInsensitiveCompare:@"rtfd"] ==
NSOrderedSame) {
- NSString *templatePath = [[NSFileManager defaultManager]
pathForApplicationSupportFile:[templateFile stringByDeletingPathExtension]
ofType:[templateFile pathExtension] inDirectory:@"Templates"];
+ NSString *templatePath = [[NSFileManager defaultManager]
pathForApplicationSupportFile:[templateFile stringByDeletingPathExtension]
ofType:[templateFile pathExtension] inDirectory:TEMPLATES_FOLDER_NAME];
NSDictionary *docAttributes = nil;
NSAttributedString *templateAttrString = [[NSAttributedString alloc]
initWithPath:templatePath documentAttributes:&docAttributes];
NSAttributedString *attrString = [SKTemplateParser
attributedStringByParsingTemplateAttributedString:templateAttrString
usingObject:self];
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit