Bind-file does not work

I have some configs file in etc that need to write in. To achieve this I used layout like below:

    bind-file: $SNAP_DATA/etc/foo.ini

to my surprise, when I write into this file, it does not reflect anything in $SNAP_DATA/etc/foo.ini. snapcraft version is 5.0. ubuntu 20.04

when you use

snap run --shell <yoursnap>.<yourapp>

you get a shell inside the snap environment to try out how that bound file behaves … note that if you want to use an existing file shipped in your snap you want to use an install hook to first copy the original file to $SNAP_DATA/etc/foo.ini

Thanks @ogra. I found the problem. I am using Qt and QSettings to read and write this file but when I call QSettings::sync() it gives a AccessError while this does not happen with QFile and it is ok.

I don’t know how to solve QSettings problem here.