I looked into the documentation but didn’t found what I was looking for. I my memory serves me well, a user is not allowed to access the apps folder, only the OS is able to.
at windows you can read/write at all folders but you have to set the permissions.
use also try catch
for folderitem use .exists method.
put any user data in user folder not global.
with build step you can add template files beside your exe or sub folders to read within your app.
Even with the correct path, writing inside the app folder must be avoided for at least two reasons:
1: it’ll break the app’s signature, so the app won’t launch subsequently.
2: non-admin users aren’t allowed to write to them (permissions).
In MacOS, the executable would be /Applications/MyApp.app/Contents/MacOS/MyApp (if the app is stored in /Applications, of course). That’s not the enclosing bundle, but the true executable.
app.executablefile returns this: …/TheApp.app/Contents/MacOS/TheApp
So app.executablefile.parent is …/TheApp.app/Contents/MacOS/
Thus app.executablefile.parent.Child(“myfile.txt”) refers to …/TheApp.app/Contents/MacOS/myfile.txt
The fact that we have app.executablefile and New FolderItem (and yet other functions, for wither the inner executable or the bundle) are confusing. I always check whether I’m knowing right, in the documentation, before using one of them.
But again, you can only READ from the app’s location, or the resources folder.
If you want to WRITE to this data, it must be in documents or application data folders, for any app you ship.