Revision: 16748
          http://sourceforge.net/p/skim-app/code/16748
Author:   hofman
Date:     2026-10-30 15:25:18 +0000 (Fri, 30 Oct 2026)
Log Message:
-----------
implement fileURL methods separately

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

Modified: trunk/SKAlias.m
===================================================================
--- trunk/SKAlias.m     2026-10-30 15:15:37 UTC (rev 16747)
+++ trunk/SKAlias.m     2026-10-30 15:25:18 UTC (rev 16748)
@@ -145,32 +145,14 @@
     }
 }
 
-- (NSURL *)fileURLAllowingUI:(BOOL)allowUI {
-    // we could cache the fileURL, but it would break when moving the file 
while we run
+- (NSURL *)fileURL {
     NSURL *fileURL = nil;
     BOOL shouldUpdate = NO;
     if (aliasHandle) {
-        fileURL = fileURLFromAliasHandle(aliasHandle, allowUI ? 0 : 
kResolveAliasFileNoUI);
+        fileURL = fileURLFromAliasHandle(aliasHandle, 0);
         shouldUpdate = YES;
     } else if (data) {
-        if (allowUI == NO) {
-            NSString *path = [[[NSURL resourceValuesForKeys:@[NSURLPathKey] 
fromBookmarkData:data] objectForKey:NSURLPathKey] stringByStandardizingPath];
-            if (path) {
-                fileURL = [NSURL fileURLWithPath:path isDirectory:[[path 
pathExtension] isCaseInsensitiveEqual:@"pdfd"]];
-                if ([fileURL checkResourceIsReachableAndReturnError:NULL]) {
-                    NSNumber *fileID = nil;
-                    NSNumber *myFileID = [[NSURL 
resourceValuesForKeys:@[NSURLFileIDKey] fromBookmarkData:data] 
objectForKey:NSURLFileIDKey];
-                    if (myFileID && [fileURL getResourceValue:&fileID 
forKey:NSURLFileIDKey error:NULL] && [fileID isEqual:myFileID] == NO)
-                        shouldUpdate = YES;
-                } else {
-                    fileURL = nil;
-                }
-            }
-        }
-        if (fileURL == nil) {
-            NSURLBookmarkResolutionOptions options = allowUI ? 0 : 
NSURLBookmarkResolutionWithoutUI | NSURLBookmarkResolutionWithoutMounting;
-            fileURL = [NSURL URLByResolvingBookmarkData:data options:options 
relativeToURL:nil bookmarkDataIsStale:&shouldUpdate error:NULL];
-        }
+        fileURL = [NSURL URLByResolvingBookmarkData:data options:0 
relativeToURL:nil bookmarkDataIsStale:&shouldUpdate error:NULL];
     }
     if (shouldUpdate && fileURL)
         [self updateWithURL:fileURL];
@@ -177,12 +159,31 @@
     return fileURL;
 }
 
-- (NSURL *)fileURL {
-    return [self fileURLAllowingUI:YES];
-}
-
 - (NSURL *)fileURLNoUI {
-    return [self fileURLAllowingUI:NO];
+    NSURL *fileURL = nil;
+    BOOL shouldUpdate = NO;
+    if (aliasHandle) {
+        fileURL = fileURLFromAliasHandle(aliasHandle, kResolveAliasFileNoUI);
+        shouldUpdate = YES;
+    } else if (data) {
+        NSString *path = [[[NSURL resourceValuesForKeys:@[NSURLPathKey] 
fromBookmarkData:data] objectForKey:NSURLPathKey] stringByStandardizingPath];
+        if (path) {
+            fileURL = [NSURL fileURLWithPath:path isDirectory:[[path 
pathExtension] isCaseInsensitiveEqual:@"pdfd"]];
+            if ([fileURL checkResourceIsReachableAndReturnError:NULL]) {
+                NSNumber *fileID = nil;
+                NSNumber *myFileID = [[NSURL 
resourceValuesForKeys:@[NSURLFileIDKey] fromBookmarkData:data] 
objectForKey:NSURLFileIDKey];
+                if (myFileID && [fileURL getResourceValue:&fileID 
forKey:NSURLFileIDKey error:NULL] && [fileID isEqual:myFileID] == NO)
+                    shouldUpdate = YES;
+            } else {
+                fileURL = nil;
+            }
+        }
+        if (fileURL == nil)
+            fileURL = [NSURL URLByResolvingBookmarkData:data 
options:NSURLBookmarkResolutionWithoutUI | 
NSURLBookmarkResolutionWithoutMounting relativeToURL:nil 
bookmarkDataIsStale:&shouldUpdate error:NULL];
+    }
+    if (shouldUpdate && fileURL)
+        [self updateWithURL:fileURL];
+    return fileURL;
 }
 
 - (BOOL)resolvesToFileURL:(NSURL *)fileURL {

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