I’m packaging a snap and trying to use layouts, since one of the node_modules used in this program is trying to write to it’s own directory withing the
$SNAP-hierarchy - (read-only).
It’s just a simple json-file, which do not exist on installation. The node_module will create it if its missing.
I’ve tried using layouts, as the documentation says (under the section «Creating new files and directories in read-only spaces») it will be writable
- assuming it does not already exist,
- even within the $SNAP-hierarchy
But I cant get it to work. Any suggestions on what I’m doing wrong or how I can overcome this?
There’s no option to change the file location in the code, and making a patch for the source code will force me to rewrite a whole lot of the base.
Edit: I guess the node_module is determining the path relative to its base by
__dirname, that equals to something similar to
/snap/snapname/revision/lib/usr/etc... and not trying to read
/usr/lib/etc, so it won’t be picked up that it’s «layouted» ?