Revision: 4748
http://skim-app.svn.sourceforge.net/skim-app/?rev=4748&view=rev
Author: hofman
Date: 2008-10-07 11:18:50 +0000 (Tue, 07 Oct 2008)
Log Message:
-----------
Add a workaround for synctex problems with files containing spaces. Synctex
adds quotes around the body of the file name
Modified Paths:
--------------
trunk/SKPDFSynchronizer.m
Modified: trunk/SKPDFSynchronizer.m
===================================================================
--- trunk/SKPDFSynchronizer.m 2008-10-07 03:26:18 UTC (rev 4747)
+++ trunk/SKPDFSynchronizer.m 2008-10-07 11:18:50 UTC (rev 4748)
@@ -327,8 +327,6 @@
#pragma mark | Server thread
- (NSString *)sourceFileForFileName:(NSString *)file
defaultExtension:(NSString *)extension {
- if ([file length] > 2 && [file characterAtIndex:0] == '"' && [file
characterAtIndex:[file length] - 1] == '"')
- file = [file substringWithRange:NSMakeRange(1, [file length] - 2)];
if (extension && [[file pathExtension] length] == 0)
file = [file stringByAppendingPathExtension:extension];
if ([file isAbsolutePath] == NO)
@@ -378,6 +376,8 @@
if ([sc scanUpToCharactersFromSet:[NSCharacterSet newlineCharacterSet]
intoString:&file] &&
[sc scanCharactersFromSet:[NSCharacterSet newlineCharacterSet]
intoString:NULL]) {
+ if ([file length] > 2 && [file characterAtIndex:0] == '"' && [file
characterAtIndex:[file length] - 1] == '"')
+ file = [file substringWithRange:NSMakeRange(1, [file length] -
2)];
file = [self sourceFileForFileName:file
defaultExtension:SKPDFSynchronizerTexExtension];
[files addObject:file];
@@ -421,6 +421,8 @@
} else if (ch == '(') {
// start of a new source file
if ([sc scanUpToCharactersFromSet:[NSCharacterSet
newlineCharacterSet] intoString:&file]) {
+ if ([file length] > 2 && [file characterAtIndex:0]
== '"' && [file characterAtIndex:[file length] - 1] == '"')
+ file = [file substringWithRange:NSMakeRange(1,
[file length] - 2)];
file = [self sourceFileForFileName:file
defaultExtension:SKPDFSynchronizerTexExtension];
[files addObject:file];
if ([lines objectForKey:file] == nil) {
@@ -578,7 +580,16 @@
BOOL rv = NO;
if (scanner)
synctex_scanner_free(scanner);
- if (scanner = synctex_scanner_new_with_output_file([theFileName
fileSystemRepresentation])) {
+ scanner = synctex_scanner_new_with_output_file([theFileName
fileSystemRepresentation]);
+ if (scanner == NULL) {
+ // synctex has the weird bug where it adds quotes around file names
contining spaces
+ NSString *quotedFileName = [[theFileName lastPathComponent]
stringByDeletingPathExtension];
+ quotedFileName = [NSString stringWithFormat:@"\"[EMAIL PROTECTED]"",
quotedFileName];
+ quotedFileName = [[theFileName stringByDeletingLastPathComponent]
stringByAppendingPathComponent:quotedFileName];
+ quotedFileName = [quotedFileName
stringByAppendingPathExtension:[theFileName pathExtension]];
+ scanner = synctex_scanner_new_with_output_file([quotedFileName
fileSystemRepresentation]);
+ }
+ if (scanner) {
[self setSyncFileName:[self
sourceFileForFileSystemRepresentation:synctex_scanner_get_synctex(scanner)
defaultExtension:nil]];
if (filenames)
[filenames removeAllObjects];
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