Revision: 16043
          http://sourceforge.net/p/skim-app/code/16043
Author:   hofman
Date:     2026-02-07 16:59:21 +0000 (Sat, 07 Feb 2026)
Log Message:
-----------
separate code to find file name for a source file

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

Modified: trunk/SKPDFSynchronizer.m
===================================================================
--- trunk/SKPDFSynchronizer.m   2026-02-07 16:27:54 UTC (rev 16042)
+++ trunk/SKPDFSynchronizer.m   2026-02-07 16:59:21 UTC (rev 16043)
@@ -142,6 +142,19 @@
     return [[file stringByResolvingSymlinksInPath] stringByStandardizingPath];
 }
 
+- (NSString *)sourceFileNameForFile:(NSString *)file {
+    file = [self sourceFileForFileName:file];
+    NSString *sourceFile = [sourceFileNames objectForKey:file];
+    if (sourceFile)
+        return sourceFile;
+    file = [file lastPathComponent];
+    for (NSString *fn in sourceFileNames) {
+        if ([[fn lastPathComponent] caseInsensitiveCompare:file] == 
NSOrderedSame)
+            return [sourceFileNames objectForKey:fn];
+    }
+    return file;
+}
+
 - (NSString *)defaultSourceFile {
     NSString *file = [[self fileName] stringByDeletingPathExtension];
     if (file == nil)
@@ -240,19 +253,7 @@
             NSPoint foundPoint = NSZeroPoint;
             SKPDFSynchronizerOptions foundOptions = options;
             BOOL success = NO;
-            NSString *fixedFile = [self sourceFileForFileName:file];
-            NSString *sourceFile = [sourceFileNames objectForKey:fixedFile];
-            if (sourceFile == nil) {
-                fixedFile = [fixedFile lastPathComponent];
-                for (NSString *fn in sourceFileNames) {
-                    if ([[fn lastPathComponent] 
caseInsensitiveCompare:fixedFile] == NSOrderedSame) {
-                        sourceFile = [sourceFileNames objectForKey:fn];
-                        break;
-                    }
-                }
-                if (sourceFile == nil)
-                    sourceFile = fixedFile;
-            }
+            NSString *sourceFile = [self sourceFileNameForFile:file];
             success = [parser findPage:&foundPageIndex location:&foundPoint 
forLine:line inFile:sourceFile];
             
             if (success && atomic_load(&shouldKeepRunning)) {

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