Solved: Writing to Mac Application Support folder
bobsneidar at iotecdigital.com
Fri Jul 14 17:17:39 EDT 2023
Create file and write permissions are very seldom different.
Sent from my iPhone
> On Jul 14, 2023, at 14:11, scott--- via use-livecode <use-livecode at lists.runrev.com> wrote:
> Hello Jacque, I haven’t encountered this yet so I’m hoping to get some advice about how to proceed. 2 questions:
> If the file (say a preference.txt file) already exists in the Preferences or App Support folder, are we able to continue writing to it? In other words, is this an issue with the creation of the file or also of writing in general?
> How are you handling this? Are you attempting to write to the Preferences or App Support folder first… and are you moving existing files to the “Container” folder?
> Thanks for the heads-up and recipe on how to create the folder.
> Scott Morrow
> Elementary Software
> (Now with 20% less chalk dust!)
> web https://elementarysoftware.com/
> email scott at elementarysoftware.com
> booth 1-360-734-4701
>> 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:
More information about the use-livecode