Hi. I’m writing a software that saves some settings in the Application data.
First I create the folder item like this
file= new folderitem(SpecialFolder.ApplicationData.NativePath+“/My Software/”+“My File.txt”)
this file is created with IsWritable = true, so I can write on it and save data into it.
If I use the Shared Application data, so like this
file= new folderitem(SpecialFolder.SharedApplicationData.NativePath+“/My Software/”+“My File.txt”)
the file is created with IsWritable = false, so I´m getting an error 13 when trying to save on it.
The solution seems easy just using the ApplicationData instead of the Shared ApplicationData, but then arrives the problem of making the installer.
I´m using Packages (Stéphane Sudre) for cresting it, and this is always saving the libraries & additional data into the Shared ApplicationData. If I use the “Current user´s home folder” domain, then the installer is not saved into the Applications folder.
So if Is the installer saves the main application into the Applications folder, then the extra packages are saved into the Shared ApplicationData and then I can´t write on them, and if I save the extra packages into the Shared ApplicationData then the main application is not installed into the Applications folder.
Maybe a solution should be using other software for making the installer of the packages, as I believe I´ll not be able to create the files into the ApplicationData with IsWrittable permissions set to true.
Saving in SpecialFolder.Preferences is the same as saving in SpecialFolder. ApplicationData. I can write on it from the software, but the problem comes when building the installer as Packages doesn´t copy the files in the User preferences, it copies it into the Shared preferences
SharedApplicationData underMacOS is in the main Library folder, and under Windows, it’s C:Program Data. Neither is a good place for your app’s settings, which belong in ApplicationData.
I suggest dragging your text file into the IDE and having your app write it back out to ApplicationData instead of trying to do it with the installer.
The way to handle this is to add a resource and a post-build bash script that figures out the current user’s Library path (the environment is set up to do that) and then use the script to copy it to the correct place.