Solved: Writing to Mac Application Support folder

Paul Hibbert paul at livecode.org
Tue Jul 11 15:54:47 EDT 2023


Thank you for sharing.

That’s a very useful snippet to save for the future.

Paul

> On Jul 10, 2023, at 1:11 PM, J. Landman Gay via use-livecode <use-livecode at lists.runrev.com> wrote:
> 
> After innumerable tests and failures I've figured out how to read/write to the Application Support folder on newer versions of MacOS X. Manually setting permissions in System Settings didn't work for my tester, and Ventura never did ask him to allow file access, so he was stuck.
> 
> In case anyone else needs to do this, here is what worked for distribution outside the Mac App Store.
> 
> 1. The app must be signed and notarized. I thank Matthias every day for his mrSignNotarizeHelper. The app does not need to be sandboxed.
> 
> 2. Apps can automatically read from and write to their own container. My problem was not knowing where the container was.
> 
> 3. The path to the container is in ~/Library/Containers/<your app bundle id>/
> 
> We don't have a specialFolderPath for that, so here's how I did it:
> 
>   put specialFolderPath("support") into tContainer
>   set the itemdel to slash
>   put "Containers/your.bundle.id/" into last item of tContainer
>   if there is no folder tContainer then
>     create folder tContainer
>     if the result <> empty then log "Create container:" && the result
>   end if
>   put tContainer & "yourFileName.ext" into tPath
> 
> This appears to work on any version of MacOS X so far, though I haven't yet heard from a tester on Mojave.
> 
> Note: in the past I could just write a file into the Preferences or the App Support folder and it worked. Now I can't. You need the app container.
> 
> -- 
> Jacqueline Landman Gay         |     jacque at hyperactivesw.com
> HyperActive Software           |     http://www.hyperactivesw.com
> 
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode



Paul
paul at livecode.org

macOS Mojave 10.14






More information about the use-livecode mailing list