Get Application Scripts directory for app group

For the current app, I can get the Application Scripts directory with FileManager.url(for: .applicationScriptsDirectory, in: .userDomainMask, appropriateFor: nil, create: true), but I cannot find a similar API for application groups. Does one exist, or do I have to construct the URL manually? That would probably be ~/Library/Application Scripts/[app group id], but there doesn't seem to be a FileManager API to access ~ either, as FileManager.default.homeDirectoryForCurrentUser returns /Users/username/Library/Containers/[app id]/Data/.

Replies

Why do you need to get this directory? The Application Scripts directory makes sense in the user, local, and system domains. Specifically, it’s used by NSUserScriptTask. However, NSUserScriptTask doesn’t have any integration with app groups.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Why do you need to get this directory?

For sharing scripts between apps. Why does it make sense to share any other data, but not Application Scripts? I was hoping that I could reduce user confusion by putting all shared data, including scripts, in one place (the app group).

Why does it make sense to share any other data, but not Application Scripts?

But NSUserScriptTask won’t find them there, which is kinda the whole reason why .applicationScriptsDirectory exists.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

But NSUserScriptTask won’t find them there

Then it's more like a limitation of how application scripts are designed to work, but I don't get it when you say that it doesn't make sense to have application scripts in an app group. App groups are meant to share data between apps, so why not application scripts as well?

The fact that the Application Scripts directory is created automatically even for app groups adds to the confusion.