Revision: 4942
http://skim-app.svn.sourceforge.net/skim-app/?rev=4942&view=rev
Author: hofman
Date: 2008-11-11 13:18:26 +0000 (Tue, 11 Nov 2008)
Log Message:
-----------
Add tex file extension only if file does not exist, and check for file with
extension. Check a few standard tex extensions.
Modified Paths:
--------------
trunk/SKPDFSynchronizer.m
Modified: trunk/SKPDFSynchronizer.m
===================================================================
--- trunk/SKPDFSynchronizer.m 2008-11-11 13:04:22 UTC (rev 4941)
+++ trunk/SKPDFSynchronizer.m 2008-11-11 13:18:26 UTC (rev 4942)
@@ -49,9 +49,8 @@
#define PDFSYNC_TO_PDF(coord) ((float)coord / 65536.0)
-static NSString *SKPDFSynchronizerTexExtension = @"tex";
static NSString *SKPDFSynchronizerPdfsyncExtension = @"pdfsync";
-static NSSet *SKPDFSynchronizerTexExtensionSet = nil;
+static NSArray *SKPDFSynchronizerTexExtensions = nil;
#pragma mark -
@@ -84,7 +83,7 @@
+ (void)initialize {
OBINITIALIZE;
- SKPDFSynchronizerTexExtensionSet = [[NSSet alloc] initWithObjects:@"tex",
@"ltx", @"latex", @"lyx", @"sty", @"cls", @"aux", @"bbl", @"idx", @"lof",
@"lot", @"exa", @"clo", @"fd", @"def", @"cfg", nil];
+ SKPDFSynchronizerTexExtensions = [[NSArray alloc] initWithObjects:@"tex",
@"ltx", @"latex", @"lyx", nil];
}
// Offset of coordinates in PDFKit and what pdfsync tells us. Don't know what
they are; is this implementation dependent?
@@ -336,10 +335,19 @@
- (NSString *)sourceFileForFileName:(NSString *)file isTeX:(BOOL)isTeX
removeQuotes:(BOOL)removeQuotes {
if (removeQuotes && [file length] > 2 && [file characterAtIndex:0] == '"'
&& [file characterAtIndex:[file length] - 1] == '"')
file = [file substringWithRange:NSMakeRange(1, [file length] - 2)];
- if (isTeX && [SKPDFSynchronizerTexExtensionSet containsObject:[[file
pathExtension] lowercaseString]] == NO)
- file = [file
stringByAppendingPathExtension:SKPDFSynchronizerTexExtension];
if ([file isAbsolutePath] == NO)
file = [[[self fileName] stringByDeletingLastPathComponent]
stringByAppendingPathComponent:file];
+ if (isTeX && SKFileExistsAtPath(file) == NO &&
[SKPDFSynchronizerTexExtensions containsObject:[[file pathExtension]
lowercaseString]] == NO) {
+ NSEnumerator *texExtensions = [SKPDFSynchronizerTexExtensions
objectEnumerator];
+ NSString *extension;
+ while (extension = [texExtensions nextObject]) {
+ NSString *tryFile = [file
stringByAppendingPathExtension:extension];
+ if (SKFileExistsAtPath(tryFile)) {
+ file = tryFile;
+ break;
+ }
+ }
+ }
// the docs say -stringByStandardizingPath uses
-stringByResolvingSymlinksInPath, but it doesn't
return [[file stringByResolvingSymlinksInPath] stringByStandardizingPath];
}
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