Revision: 4247
http://skim-app.svn.sourceforge.net/skim-app/?rev=4247&view=rev
Author: hofman
Date: 2008-07-18 10:24:36 +0000 (Fri, 18 Jul 2008)
Log Message:
-----------
Localize a string. Use macros for extensions.
Modified Paths:
--------------
trunk/SkimNotes/Dutch.lproj/SkimNotes.strings
trunk/SkimNotes/English.lproj/SkimNotes.strings
trunk/SkimNotes/NSFileManager_SKNExtensions.m
Modified: trunk/SkimNotes/NSFileManager_SKNExtensions.m
===================================================================
--- trunk/SkimNotes/NSFileManager_SKNExtensions.m 2008-07-18 09:50:36 UTC
(rev 4246)
+++ trunk/SkimNotes/NSFileManager_SKNExtensions.m 2008-07-18 10:24:36 UTC
(rev 4247)
@@ -40,6 +40,11 @@
#import "SKNExtendedAttributeManager.h"
#import "SKNUtilities.h"
+#define PDF_EXTENSION @"pdf"
+#define SKIM_EXTENSION @"skim"
+#define TXT_EXTENSION @"txt"
+#define RTF_EXTENSION @"rtf"
+
@implementation NSFileManager (SKNExtensions)
- (BOOL)writeSkimNotes:(NSArray *)notes toExtendedAttributesAtURL:(NSURL
*)aURL error:(NSError **)outError {
@@ -145,7 +150,7 @@
BOOL isDir;
if ([aURL isFileURL] && [self fileExistsAtPath:path isDirectory:&isDir] &&
isDir) {
- NSString *skimFile = [self bundledFileWithExtension:@"skim"
inPDFBundleAtPath:path error:&error];
+ NSString *skimFile = [self bundledFileWithExtension:SKIM_EXTENSION
inPDFBundleAtPath:path error:&error];
NSData *data = skimFile ? [NSData dataWithContentsOfFile:skimFile
options:0 error:&error] : nil;
if ([data length])
@@ -165,7 +170,7 @@
BOOL isDir;
if ([aURL isFileURL] && [self fileExistsAtPath:path isDirectory:&isDir] &&
isDir) {
- NSString *notesFile = [self bundledFileWithExtension:@"txt"
inPDFBundleAtPath:path error:&error];
+ NSString *notesFile = [self bundledFileWithExtension:TXT_EXTENSION
inPDFBundleAtPath:path error:&error];
if (notesFile)
string = [NSString stringWithContentsOfFile:notesFile
encoding:NSUTF8StringEncoding error:&error];
@@ -185,7 +190,7 @@
BOOL isDir;
if ([aURL isFileURL] && [self fileExistsAtPath:path isDirectory:&isDir] &&
isDir) {
- NSString *notesFile = [self bundledFileWithExtension:@"rtf"
inPDFBundleAtPath:path error:&error];
+ NSString *notesFile = [self bundledFileWithExtension:RTF_EXTENSION
inPDFBundleAtPath:path error:&error];
if (notesFile)
data = [NSData dataWithContentsOfFile:notesFile options:0
error:&error];
@@ -220,7 +225,7 @@
NSString *filePath = nil;
extension = [extension lowercaseString];
- if ([extension isEqualToString:@"skim"] || [extension
isEqualToString:@"pdf"]) {
+ if ([extension isEqualToString:SKIM_EXTENSION] || [extension
isEqualToString:PDF_EXTENSION]) {
NSArray *files = [self subpathsAtPath:path];
NSString *filename = [[[path lastPathComponent]
stringByDeletingPathExtension] stringByAppendingPathExtension:extension];
if ([files containsObject:filename] == NO) {
@@ -233,7 +238,7 @@
if (filename)
filePath = [path stringByAppendingPathComponent:filename];
} else {
- NSString *skimFile = [self bundledFileWithExtension:@"skim"
inPDFBundleAtPath:path error:outError];
+ NSString *skimFile = [self bundledFileWithExtension:SKIM_EXTENSION
inPDFBundleAtPath:path error:outError];
if (skimFile) {
filePath = [[skimFile stringByDeletingPathExtension]
stringByAppendingPathExtension:extension];
if ([self fileExistsAtPath:filePath] == NO)
@@ -241,7 +246,7 @@
}
}
if (filePath == nil && outError)
- *outError = [NSError errorWithDomain:NSPOSIXErrorDomain code:ENOENT
userInfo:[NSDictionary dictionaryWithObjectsAndKeys:@"Notes file note found",
NSLocalizedDescriptionKey, nil]];
+ *outError = [NSError errorWithDomain:NSPOSIXErrorDomain code:ENOENT
userInfo:[NSDictionary dictionaryWithObjectsAndKeys:SKNLocalizedString(@"Notes
file note found", @"Error description"), NSLocalizedDescriptionKey, nil]];
return filePath;
}
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