Reputation: 433
I've written a short swift code to add a button to the finder which creates a new blank file at the current directory via a system touch
call. The extension gets the current directory fine (via FIFinderSyncController.defaultController().targetedURL()
), but the touch
command failed due to sandboxing. How do I ask for permission for the write access? The user-selected file option is not triggered for my code.
Upvotes: 1
Views: 597
Reputation: 2874
As far as I know, this isn't possible, and furthermore, this is not the purpose of Finder sync extensions. Apple says here that:
Make sure the Finder Sync extension point is appropriate for the functionality you plan to provide. The best Finder Sync extensions support apps that sync the contents of a local folder with a remote data source. Finder Sync is not intended as a general tool for modifying the Finder’s user interface.
If you want to modify Finder to do what you purpose, you'd have to:
I'd suggest the latter. Apple is making it more and more difficult to modify the system with every release (for better or for worse). If you need this functionality, file a bug report requesting it.
Upvotes: 0
Reputation: 1591
You should be able to use a temporary exception entitlement as described here. More specifically, one of the two entitlements should be sufficient:
com.apple.security.temporary-exception.files.home-relative-path.read-write
com.apple.security.temporary-exception.files.absolute-path.read-write
As noted in the documentation, you should submit your reasons for needing a temporary exception entitlement if you plan on submitting your app to the App Store. (I've never gone through this procedure, so I'm not sure how what this process is like).
Upvotes: 1
Reputation: 14160
As far as I know this should not be possible within Finder sync extension. However, as the workaround you may transfer this functionality to the main application - first ask user to drag drive, where functionality will be enabled, to the app main window, save security bookmark, and then send command from Finder extension to the main app.
Upvotes: 1