Can't find file in $SNAP_USER_DATA

My Python script saves its settings to a file called ‘config’ (the file has no extension). I read that the correct folder to put writable config files is $SNAP_USER_DATA. The issue is: my config file does not end up in that folder.

I have this section in my snapcraft.yaml file:

    plugin: dump
    source-type: git
    after: [desktop-gtk3]
      glade_files: bin/glade_files
      bin/config: $SNAP_USER_DATA/config
    override-pull: |
      snapcraftctl pull
      chmod +x bin/

From the organize section, I’m attempting to move the file from bin/config to $SNAP_USER_DATA/config
But the file is not ending up in $SNAP_USER_DATA.
Any ideas?

$SNAP_USER_DATA is defined when your snap is run, not when snapcraft builds it. You can bundle the config file in your snap then write a wrapper script to move the config file to the correct location when your snap is run for the first time by a user.

1 Like

Thanks for your suggestion - it’s working now.