Post

Replies

Boosts

Views

Activity

Reply to Swift MacOS-Check if a file at a URL is open
Thanks for that, and I understand the issues. For my purposes, I would like to do what is possible with Apple Script. To get the list of all apps in the foreground and then get a list of urls to their open documents. I know,to make this work, the apps need to support scripting. And also, including such a script might lead to App Store rejection, as it would require disabling sandboxing. Any suggestions?
Topic: App & System Services SubTopic: Core OS Tags:
Apr ’25
Reply to How to Trigger Permission Dialogue for Accessing the User's Desktop in macOS?
I used the following code: func getDesktopConent(){ let fileManager = FileManager.default let desktopURL = fileManager.urls(for: .desktopDirectory, in: .userDomainMask).first! guard let resolovedDesktopURL = resolveFinderAlias(at: desktopURL) else{ message = "Could not resolve desktop content" return } if let content = try? FileManager.default.contentsOfDirectory(at: resolovedDesktopURL, includingPropertiesForKeys: nil ){ message = "Found \(content.count) on Desktop" } else{ message = "Could not access desktop" } } and get the message "Could not access desktop"
Topic: App & System Services SubTopic: Core OS Tags:
Mar ’25