Revision: 16742
          http://sourceforge.net/p/skim-app/code/16742
Author:   hofman
Date:     2026-10-29 17:15:27 +0000 (Thu, 29 Oct 2026)
Log Message:
-----------
get file name for fallback bookmark label from bookmark data when we cannot 
resolve the alias

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

Modified: trunk/SKAlias.h
===================================================================
--- trunk/SKAlias.h     2026-10-29 15:30:58 UTC (rev 16741)
+++ trunk/SKAlias.h     2026-10-29 17:15:27 UTC (rev 16742)
@@ -49,6 +49,7 @@
 @property (nonatomic, readonly, getter=isBookmark) BOOL bookmark;
 @property (nonatomic, nullable, readonly) NSURL *fileURL;
 @property (nonatomic, nullable, readonly) NSURL *fileURLNoUI;
+@property (nonatomic, nullable, readonly) NSString *name;
 
 - (nullable instancetype)initWithAliasData:(NSData *)data 
NS_DESIGNATED_INITIALIZER;
 - (nullable instancetype)initWithBookmarkData:(NSData *)data 
NS_DESIGNATED_INITIALIZER;

Modified: trunk/SKAlias.m
===================================================================
--- trunk/SKAlias.m     2026-10-29 15:30:58 UTC (rev 16741)
+++ trunk/SKAlias.m     2026-10-29 17:15:27 UTC (rev 16742)
@@ -43,7 +43,7 @@
 
 @implementation SKAlias
 
-@dynamic data, bookmark, fileURL, fileURLNoUI;
+@dynamic data, bookmark, fileURL, fileURLNoUI, name;
 
 #pragma clang diagnostic push
 #pragma clang diagnostic ignored "-Wdeprecated-declarations"
@@ -221,4 +221,12 @@
     return NO;
 }
 
+- (NSString *)name {
+    NSString *name = nil;
+    NSURL *fileURL = [self fileURLNoUI];
+    if ((fileURL == nil || NO == [fileURL getResourceValue:&name 
forKey:NSURLLocalizedNameKey error:NULL]) && aliasHandle == nil)
+        name = [[NSURL resourceValuesForKeys:@[NSURLNameKey] 
fromBookmarkData:data] objectForKey:NSURLNameKey] ?: [[[NSURL 
resourceValuesForKeys:@[NSURLPathKey] fromBookmarkData:data] 
objectForKey:NSURLPathKey] lastPathComponent];
+    return name;
+}
+
 @end

Modified: trunk/SKBookmark.m
===================================================================
--- trunk/SKBookmark.m  2026-10-29 15:30:58 UTC (rev 16741)
+++ trunk/SKBookmark.m  2026-10-29 17:15:27 UTC (rev 16742)
@@ -573,7 +573,7 @@
 - (NSString *)label {
     NSString *theLabel = label;
     if ([theLabel length] == 0)
-        [[self fileURL] getResourceValue:&theLabel 
forKey:NSURLLocalizedNameKey error:NULL];
+        theLabel = [alias name];
     return theLabel ?: @"";
 }
 

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