Updating the project

Hello
I would like to find out how to make it so that when updating my snap package, it performs a new update on top of the old one. It’s just that my project is a directory that the user works with, and if I added changes to the configuration files, then these files were updated during the releases, but the files that the user himself added remained

Can’t anyone answer my question?

Where in your snap are you storing these files? It sounds like your snap maybe should copy these files from $SNAP (which is read-only and will change to the new version of your snap every time your snap refreshes) to somewhere like $SNAP_USER_COMMON, which will persist from one revision to another with the same set of files that were there already

The catalog is downloaded to the source folder snap
image
image
Here is my snapcraft. yaml
image

I’m not sure if I understood the problem, could you re-explain it in a different way? In what part of the filesystem are the user files currently stored? Are the changes in configuration files made by the user or are they part of a new version of the package?

The entire directory is stored in the snap root and is read-only.
I’m trying to figure out how to make some files and folders readable and others writable.
And also when updating the package to a new version, the changes that the user made to the old directory were transferred to the new one.

The snap package contents are read-only, and there’s no way to change that. User data, however, may be stored in separate areas in the filesystem. Maybe this discussion could help?

Here is my project when installing it, it is installed only in the root of snap, but since the files in the root directory are read-only, the user cannot work with snap. How can I make it so that the user can work with these directories ?

@geor444 re-read cmatsuoka’s comment immediately above yours:

You cannot modify a snap filesystem after it has been installed. This is a planned, and designed, feature. If you need the user to be able to edit files those must be created or copied from the snap at a user-writable location. The approved paths are stored in the environment variables $SNAP_USER_DATA and $SNAP_USER_COMMON, which are readable by your application at run-time so it can determine where the user’s files are located.

The problem is that I don’t understand how to do this, and there is no example of how it works in the documentation

see my answer in this thread how to copy files from the read-only space to a writable area using an install hook: