Revision: 15755
http://sourceforge.net/p/skim-app/code/15755
Author: hofman
Date: 2025-11-03 17:28:34 +0000 (Mon, 03 Nov 2025)
Log Message:
-----------
use macros for UTTypes as NSStrings
Modified Paths:
--------------
trunk/SKBookmark.m
trunk/SKScriptMenu.m
Modified: trunk/SKBookmark.m
===================================================================
--- trunk/SKBookmark.m 2025-11-03 17:06:47 UTC (rev 15754)
+++ trunk/SKBookmark.m 2025-11-03 17:28:34 UTC (rev 15755)
@@ -62,6 +62,8 @@
#define TYPE_KEY @"type"
#define SNAPSHOTS_KEY @"snapshots"
+#define SKUTTypeFolder (__bridge NSString *)kUTTypeFolder
+
@interface SKPlaceholderBookmark : SKBookmark
@end
@@ -126,7 +128,7 @@
SKBookmark *bookmark;
NSString *label = nil;
[url getResourceValue:&label forKey:NSURLLocalizedNameKey error:NULL];
- if ([[NSWorkspace sharedWorkspace] type:fileType
conformsToType:SKDocumentTypeFolder]) {
+ if ([[NSWorkspace sharedWorkspace] type:fileType
conformsToType:SKUTTypeFolder]) {
NSArray *children = [self bookmarksForURLs:[fm
contentsOfDirectoryAtURL:url includingPropertiesForKeys:@[]
options:NSDirectoryEnumerationSkipsHiddenFiles error:NULL]];
if ([children count] && (bookmark = [[self alloc]
initFolderWithChildren:children label:label])) {
[array addObject:bookmark];
@@ -695,7 +697,7 @@
type = [aType integerValue];
else if (aURL == nil)
type = SKBookmarkTypeSession;
- else if ([[NSWorkspace sharedWorkspace] type:[[NSWorkspace
sharedWorkspace] typeOfFile:[aURL path] error:NULL] conformsToType:(__bridge
NSString *)kUTTypeFolder])
+ else if ([[NSWorkspace sharedWorkspace] type:[[NSWorkspace
sharedWorkspace] typeOfFile:[aURL path] error:NULL]
conformsToType:SKUTTypeFolder])
type = SKBookmarkTypeFolder;
else
type = SKBookmarkTypeBookmark;
Modified: trunk/SKScriptMenu.m
===================================================================
--- trunk/SKScriptMenu.m 2025-11-03 17:06:47 UTC (rev 15754)
+++ trunk/SKScriptMenu.m 2025-11-03 17:28:34 UTC (rev 15755)
@@ -47,6 +47,13 @@
#define TITLE_KEY @"title"
#define CONTENT_KEY @"content"
+#define SKUTTypeFolder (__bridge NSString *)kUTTypeFolder
+#define SKUTTypeApplication (__bridge NSString *)kUTTypeApplication
+#define SKUTTypeAutomatorWorkflow @"com.apple.automator-workflow"
+#define SKUTTypeAppleScriptScript @"com.apple.applescript.script"
+#define SKUTTypeAppleScriptText @"com.apple.applescript.text"
+#define SKUTTypeAppleScriptScriptBundle @"com.apple.applescript.script-bundle"
+
@interface SKScriptMenuController : NSObject <NSMenuDelegate> {
NSMenu *scriptMenu;
FSEventStreamRef streamRef;
@@ -171,27 +178,27 @@
static BOOL isAppleScriptUTI(NSString *theUTI) {
if (theUTI == NULL)
return NO;
- return [[NSWorkspace sharedWorkspace] type:theUTI
conformsToType:@"com.apple.applescript.script"] ||
- [[NSWorkspace sharedWorkspace] type:theUTI
conformsToType:@"com.apple.applescript.text"] ||
- [[NSWorkspace sharedWorkspace] type:theUTI
conformsToType:@"com.apple.applescript.script-bundle"];
+ return [[NSWorkspace sharedWorkspace] type:theUTI
conformsToType:SKUTTypeAppleScriptScript] ||
+ [[NSWorkspace sharedWorkspace] type:theUTI
conformsToType:SKUTTypeAppleScriptText] ||
+ [[NSWorkspace sharedWorkspace] type:theUTI
conformsToType:SKUTTypeAppleScriptScriptBundle];
}
static BOOL isApplicationUTI(NSString *theUTI) {
if (theUTI == NULL)
return NO;
- return [[NSWorkspace sharedWorkspace] type:theUTI conformsToType:(__bridge
NSString *)kUTTypeApplication];
+ return [[NSWorkspace sharedWorkspace] type:theUTI
conformsToType:SKUTTypeApplication];
}
static BOOL isAutomatorWorkflowUTI(NSString *theUTI) {
if (theUTI == NULL)
return NO;
- return [[NSWorkspace sharedWorkspace] type:theUTI
conformsToType:@"com.apple.automator-workflow"];
+ return [[NSWorkspace sharedWorkspace] type:theUTI
conformsToType:SKUTTypeAutomatorWorkflow];
}
static BOOL isFolderUTI(NSString *theUTI) {
if (theUTI == NULL)
return NO;
- return [[NSWorkspace sharedWorkspace] type:theUTI conformsToType:(__bridge
NSString *)kUTTypeFolder];
+ return [[NSWorkspace sharedWorkspace] type:theUTI
conformsToType:SKUTTypeFolder];
}
- (NSArray *)directoryContentsAtURL:(NSURL *)url
recursionDepth:(NSInteger)depth {
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