Re: Solved: Writing to Mac Application Support folder
As I’m now working to get an app ready for Sonoma, I’m wondering what the official resolution is to writing to both the “Preferences” folder and the “Application Support” folder. What I’m finding is that this question from Jacque is the last in this thread. Was there a response from Panos or Mark? I will be dealing with existing customers upgrading to Sonoma as well as new customers and don’t want my inbox flooded with angry emails! Marty > On Jul 15, 2023, at 1:22 PM, J. Landman Gay via use-livecode > wrote: > > Good approach. I assume if there is no file in Preferences, you write > defaults directly to the container. > > I got curious and looked at where LC stores its files. They do not have a > container. It's mostly in Application Support, in a folder "RunRev" (there's > also an older one there named "Runtime Revolution".) Some of the files were > updated recently so it apparently still works. Now I wonder if there's > another way to do this stuff. > > I'd like some definitive info about this. @Panos? @Mark? > > On 7/15/23 12:24 AM, scott--- via use-livecode wrote: >> Thanks again, Jacque. >> My solution for migrating preference files from the Preferences folder to >> the Container turned out to be quite simple but for some reason I spent a >> bunch of time pondering other more complicated methods. In the end I changed >> an existing function which returns a path to the preferences file and had it >> first look to see if a Container exists. If it doesn’t then it creates the >> Container but still returns the path to the original Preferences folder. >> (This works in my use case because the app's first call to this function >> will always be to “read” the preference file) Now that the Container >> exists, all future calls to the function will return the Container path… and >> the original data, having been already loaded into the app, is ready to >> write to (and read from) the new Container location. > > > > -- > Jacqueline Landman Gay | jac...@hyperactivesw.com > HyperActive Software | http://www.hyperactivesw.com > ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Solved: Writing to Mac Application Support folder
Good approach. I assume if there is no file in Preferences, you write defaults directly to the container. I got curious and looked at where LC stores its files. They do not have a container. It's mostly in Application Support, in a folder "RunRev" (there's also an older one there named "Runtime Revolution".) Some of the files were updated recently so it apparently still works. Now I wonder if there's another way to do this stuff. I'd like some definitive info about this. @Panos? @Mark? On 7/15/23 12:24 AM, scott--- via use-livecode wrote: Thanks again, Jacque. My solution for migrating preference files from the Preferences folder to the Container turned out to be quite simple but for some reason I spent a bunch of time pondering other more complicated methods. In the end I changed an existing function which returns a path to the preferences file and had it first look to see if a Container exists. If it doesn’t then it creates the Container but still returns the path to the original Preferences folder. (This works in my use case because the app's first call to this function will always be to “read” the preference file) Now that the Container exists, all future calls to the function will return the Container path… and the original data, having been already loaded into the app, is ready to write to (and read from) the new Container location. -- Jacqueline Landman Gay | jac...@hyperactivesw.com HyperActive Software | http://www.hyperactivesw.com ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Solved: Writing to Mac Application Support folder
Thanks again, Jacque. My solution for migrating preference files from the Preferences folder to the Container turned out to be quite simple but for some reason I spent a bunch of time pondering other more complicated methods. In the end I changed an existing function which returns a path to the preferences file and had it first look to see if a Container exists. If it doesn’t then it creates the Container but still returns the path to the original Preferences folder. (This works in my use case because the app's first call to this function will always be to “read” the preference file) Now that the Container exists, all future calls to the function will return the Container path… and the original data, having been already loaded into the app, is ready to write to (and read from) the new Container location. -- Scott Morrow Elementary Software (Now with 20% less chalk dust!) web https://elementarysoftware.com/ email sc...@elementarysoftware.com booth1-360-734-4701 -- > On Jul 14, 2023, at 4:05 PM, J. Landman Gay via use-livecode > wrote: > > 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 | jac...@hyperactivesw.com > HyperActive Software | http://www.hyperactivesw.com ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Solved: Writing to Mac Application Support folder
What I found out is that the app container has permission automatically. That's the only place though. All other file access has to be initiated by the user. -- Jacqueline Landman Gay | jac...@hyperactivesw.com HyperActive Software | http://www.hyperactivesw.com On July 14, 2023 6:18:45 PM Bob Sneidar via use-livecode wrote: I don’t think there is any way past this. Ultimately the permissions to write to any path must be authorized by the current user agent. If they accept, well and good. If not, there cannot be any way around it. Sent from my iPhone On Jul 14, 2023, at 16:07, J. Landman Gay via use-livecode wrote: 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 | jac...@hyperactivesw.com HyperActive Software | http://www.hyperactivesw.com ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Solved: Writing to Mac Application Support folder
I don’t think there is any way past this. Ultimately the permissions to write to any path must be authorized by the current user agent. If they accept, well and good. If not, there cannot be any way around it. Sent from my iPhone > On Jul 14, 2023, at 16:07, J. Landman Gay via use-livecode > wrote: > > 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 | jac...@hyperactivesw.com > HyperActive Software | http://www.hyperactivesw.com > > ___ > use-livecode mailing list > use-livecode@lists.runrev.com > Please visit this url to subscribe, unsubscribe and manage your subscription > preferences: > http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Solved: Writing to Mac Application Support folder
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 | jac...@hyperactivesw.com HyperActive Software | http://www.hyperactivesw.com ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Solved: Writing to Mac Application Support folder
Create file and write permissions are very seldom different. Sent from my iPhone > On Jul 14, 2023, at 14:11, scott--- via use-livecode > 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 sc...@elementarysoftware.com > booth1-360-734-4701 > -- > >> On Jul 10, 2023, at 1:11 PM, J. Landman Gay via use-livecode >> 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// >> >> 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 | jac...@hyperactivesw.com >> HyperActive Software | http://www.hyperactivesw.com > > > ___ > use-livecode mailing list > use-livecode@lists.runrev.com > Please visit this url to subscribe, unsubscribe and manage your subscription > preferences: > http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Solved: Writing to Mac Application Support folder
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 sc...@elementarysoftware.com booth1-360-734-4701 -- > On Jul 10, 2023, at 1:11 PM, J. Landman Gay via use-livecode > 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// > > 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 | jac...@hyperactivesw.com > HyperActive Software | http://www.hyperactivesw.com ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Solved: Writing to Mac Application Support folder
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 sc...@elementarysoftware.com booth1-360-734-4701 -- > On Jul 10, 2023, at 1:11 PM, J. Landman Gay via use-livecode > 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// > > 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 | jac...@hyperactivesw.com > HyperActive Software | http://www.hyperactivesw.com ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Solved: Writing to Mac Application Support folder
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 > 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// > > 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 | jac...@hyperactivesw.com > HyperActive Software | http://www.hyperactivesw.com > > ___ > use-livecode mailing list > use-livecode@lists.runrev.com > Please visit this url to subscribe, unsubscribe and manage your subscription > preferences: > http://lists.runrev.com/mailman/listinfo/use-livecode Paul p...@livecode.org macOS Mojave 10.14 ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Solved: Writing to Mac Application Support folder
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// 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 | jac...@hyperactivesw.com HyperActive Software | http://www.hyperactivesw.com ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode