Revision: 16034
          http://sourceforge.net/p/skim-app/code/16034
Author:   hofman
Date:     2026-02-05 15:56:49 +0000 (Thu, 05 Feb 2026)
Log Message:
-----------
Standardize syncfile separately. Standardizing a source file again won't find a 
different file.

Modified Paths:
--------------
    trunk/SKPDFSynchronizer.m

Modified: trunk/SKPDFSynchronizer.m
===================================================================
--- trunk/SKPDFSynchronizer.m   2026-02-04 23:01:13 UTC (rev 16033)
+++ trunk/SKPDFSynchronizer.m   2026-02-05 15:56:49 UTC (rev 16034)
@@ -108,6 +108,10 @@
 
 // this should only be used from the server thread
 - (void)setSyncFileName:(NSString *)newSyncFileName {
+    // make sure the path is absolute and standardized
+    if ([newSyncFileName isAbsolutePath] == NO)
+        newSyncFileName = [[[self fileName] stringByDeletingLastPathComponent] 
stringByAppendingPathComponent:newSyncFileName];
+    newSyncFileName = [[newSyncFileName stringByResolvingSymlinksInPath] 
stringByStandardizingPath];
     [lock lock];
     if (syncFileName != newSyncFileName) {
         syncFileName = newSyncFileName;
@@ -128,11 +132,11 @@
 
 #pragma mark Support
 
-- (NSString *)sourceFileForFileName:(NSString *)file isTeX:(BOOL)isTeX {
+- (NSString *)sourceFileForFileName:(NSString *)file {
     NSFileManager *fm = [NSFileManager defaultManager];
     if ([file isAbsolutePath] == NO)
         file = [[[self fileName] stringByDeletingLastPathComponent] 
stringByAppendingPathComponent:file];
-    if (isTeX && [fm fileExistsAtPath:file] == NO && 
[SKPDFSynchronizerTexExtensions containsObject:[[file pathExtension] 
lowercaseString]] == NO) {
+    if ([fm fileExistsAtPath:file] == NO && [SKPDFSynchronizerTexExtensions 
containsObject:[[file pathExtension] lowercaseString]] == NO) {
         for (NSString *extension in SKPDFSynchronizerTexExtensions) {
             NSString *tryFile = [file 
stringByAppendingPathExtension:extension];
             if ([fm fileExistsAtPath:tryFile]) {
@@ -166,13 +170,13 @@
         parser = [[SKSyncTeXParser alloc] initWithFileName:theFileName];
     if (parser) {
         isPdfsync = pdfSync;
-        [self setSyncFileName:[self sourceFileForFileName:[parser 
syncFileName] isTeX:NO]];
+        [self setSyncFileName:[parser syncFileName]];
         if (sourceFileNames == nil)
             sourceFileNames = [[NSMutableDictionary alloc] init];
         else
             [sourceFileNames removeAllObjects];
         [parser enumerateSourceFilesUsingBlock:^(NSString *file){
-            [sourceFileNames setObject:file forKey:[self 
sourceFileForFileName:file isTeX:YES]];
+            [sourceFileNames setObject:file forKey:[self 
sourceFileForFileName:file]];
         }];
         rv = atomic_load(&shouldKeepRunning);
     }
@@ -218,7 +222,7 @@
             BOOL success = [parser findFile:&foundFile line:&foundLine 
forLocation:point inRect:rect pageBounds:bounds atPageIndex:pageIndex];
             
             if (success && atomic_load(&shouldKeepRunning)) {
-                foundFile = [[sourceFileNames allKeysForObject:foundFile] 
firstObject] ?: [self sourceFileForFileName:foundFile isTeX:YES];
+                foundFile = [[sourceFileNames allKeysForObject:foundFile] 
firstObject] ?: [self sourceFileForFileName:foundFile];
                 dispatch_async(dispatch_get_main_queue(), ^{
                     [delegate synchronizerFoundLine:foundLine 
inFile:foundFile];
                 });
@@ -236,8 +240,8 @@
             NSPoint foundPoint = NSZeroPoint;
             SKPDFSynchronizerOption foundOptions = options;
             BOOL success = NO;
-            NSString *fixedFile = [self sourceFileForFileName:file isTeX:YES];
-            NSString *sourceFile = [sourceFileNames objectForKey:fixedFile] ?: 
[sourceFileNames objectForKey:[[fixedFile stringByResolvingSymlinksInPath] 
stringByStandardizingPath]];
+            NSString *fixedFile = [self sourceFileForFileName:file];
+            NSString *sourceFile = [sourceFileNames objectForKey:fixedFile];
             if (sourceFile == nil) {
                 for (NSString *fn in sourceFileNames) {
                     if ([[fn lastPathComponent] 
caseInsensitiveCompare:[fixedFile lastPathComponent]] == NSOrderedSame) {

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

Reply via email to