Solved: Writing to Mac Application Support folder
J. Landman Gay
jacque at hyperactivesw.com
Fri Jul 14 19:05:47 EDT 2023
On 7/14/23 4:10 PM, scott--- via use-livecode wrote:
> 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?
That's a very good question and I'm afraid I don't know the answer. It's worrying though,
because a couple of my older products need to write to Preferences. Here's what I do know.
The issue only came up recently. My tester with the problem is on Ventura but I suspect it's a
little older than that.
In the past I always wrote files to Preferences without issues. For my current project there
was already a prefs file there and it worked. But it also worked if I put it directly in App
Support, and also worked if I made a container. In fact, it worked anywhere because it's my
machine. Not so for others.
For the tester, I originally tried to create and write the file in Preferences as usual. It
didn't work and no file was created. Another tester, also on Ventura, had the Mac ask for
permissions, he gave it, and it worked. Everything else I subsequently tried also worked for him.
Next, I changed the app to write directly to Application Support. Same problem, no file was
created, the Mac didn't ask for permission. So I changed it again to create a folder in
Application Support with the name of the app and put the prefs file in there. Same failure.
Finally, I created the container folder in ~/Library/Conainers and bingo, success.
The tester who gave permissions and had no trouble at any point, including reading and writing
to the container.
Since I can't test on my own machine, I'm waiting for someone who has my older products to tell
me there's a problem. Or I'll lean on my husband to try it. Husbands are good for things like that.
Jacqueline Landman Gay | jacque at hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
More information about the use-livecode