Revision: 4338
http://skim-app.svn.sourceforge.net/skim-app/?rev=4338&view=rev
Author: hofman
Date: 2008-08-02 23:33:14 +0000 (Sat, 02 Aug 2008)
Log Message:
-----------
Fix capitalization of file names for tex-pdf sync, as we compare case
sensitively (because they're used as dictionary keys in pdfsync and we don't
control synctex). Pass only the last path component to synctex. This is not
fool proof, as this may not be what was actually passed in the tex file, but
unfortunately we have no way of knowing what was passed in.
Modified Paths:
--------------
trunk/Files_SKExtensions.h
trunk/Files_SKExtensions.m
trunk/SKPDFSynchronizer.m
Modified: trunk/Files_SKExtensions.h
===================================================================
--- trunk/Files_SKExtensions.h 2008-08-02 19:25:19 UTC (rev 4337)
+++ trunk/Files_SKExtensions.h 2008-08-02 23:33:14 UTC (rev 4338)
@@ -48,6 +48,7 @@
extern BOOL SKFileExistsAtPath(NSString *path);
extern NSDate *SKFileModificationDateAtPath(NSString *path);
extern NSString *SKPathFromFileSystemRepresentation(const char *path);
+extern NSString *SKRealPath(NSString *path);
extern NSString *SKUniqueDirectoryCreating(NSString *basePath, BOOL create);
extern NSString *SKChewableItemsDirectory();
extern NSString *SKUniqueTemporaryDirectory();
Modified: trunk/Files_SKExtensions.m
===================================================================
--- trunk/Files_SKExtensions.m 2008-08-02 19:25:19 UTC (rev 4337)
+++ trunk/Files_SKExtensions.m 2008-08-02 23:33:14 UTC (rev 4338)
@@ -124,6 +124,18 @@
return thePath;
}
+NSString *SKRealPath(NSString *path) {
+ FSRef fileRef;
+ NSURL *url = nil;
+ if (CFURLGetFSRef((CFURLRef)[NSURL fileURLWithPath:path], &fileRef))
+ url = (NSURL*)CFURLCreateFromFSRef(NULL, &fileRef);
+ if (url) {
+ path = [url path];
+ [url release];
+ }
+ return path;
+}
+
NSString *SKUniqueDirectoryCreating(NSString *basePath, BOOL create) {
CFUUIDRef uuid = CFUUIDCreate(NULL);
NSString *tmpDirName = [(NSString *)CFUUIDCreateString(NULL, uuid)
autorelease];
Modified: trunk/SKPDFSynchronizer.m
===================================================================
--- trunk/SKPDFSynchronizer.m 2008-08-02 19:25:19 UTC (rev 4337)
+++ trunk/SKPDFSynchronizer.m 2008-08-02 23:33:14 UTC (rev 4338)
@@ -54,9 +54,9 @@
static NSString *SKTeXSourceFile(NSString *file, NSString *base) {
if ([[file pathExtension]
caseInsensitiveCompare:SKPDFSynchronizerTexExtension] != NSOrderedSame)
file = [file
stringByAppendingPathExtension:SKPDFSynchronizerTexExtension];
- if ([file hasPrefix:@"/"] == NO)
+ if ([file isAbsolutePath] == NO)
file = [base stringByAppendingPathComponent:file];
- return file;
+ return SKRealPath(file);
}
#pragma mark -
@@ -584,7 +584,7 @@
- (BOOL)synctexFindPage:(unsigned int *)pageIndex location:(NSPoint *)point
forLine:(int)line inFile:(NSString *)file {
BOOL rv = NO;
- if (synctex_display_query(scanner, [file fileSystemRepresentation], line,
0) > 0) {
+ if (synctex_display_query(scanner, [[file lastPathComponent]
fileSystemRepresentation], line, 0) > 0) {
synctex_node_t node = synctex_next_result(scanner);
if (node) {
unsigned int page = synctex_node_page(node);
@@ -649,6 +649,8 @@
NSPoint foundPoint = NSZeroPoint;
BOOL success = NO;
+ file = SKRealPath(file);
+
if (isPdfsync)
success = [self pdfsyncFindPage:&foundPageIndex
location:&foundPoint forLine:line inFile:file];
else
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