Unable to change/modify/write app data

I’m making my first snap. I have an app that reads from some files and periodically writes information back into them. I was able to snap the dependent files and run the program, but it does not write back. Through research, I’ve discovered that this is a security measure snap takes.
What is the best practice for my use case? Is there some place in the snap that I’m allowed to write to files, should I be storing these dependent files differently, or should I be disabling the feature?

Thanks for helping.

Please read through Snapping Philosophy to understand the high level picture, and Security policy and sandboxing for some more detailed information.

2 Likes

Thanks, that’s what I was looking for. It seems I should be using $SNAP_COMMON. How would I go about getting those files into $SNAP_COMMON on installation? I’ve been trying something like this, but it hasn’t worked:

userfiles:
plugin: dump
source: ./User_Files/
organize:
userfiles: $SNAP_COMMON

Am I supposed to move the user files in on runtime or can I put them on installation?

I figured it out, had to use hooks.
I used this for reference: https://docs.snapcraft.io/build-snaps/hooks