Solved: Writing to Mac Application Support folder

J. Landman Gay jacque at hyperactivesw.com
Mon Jul 10 16:11:56 EDT 2023


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



More information about the use-livecode mailing list