I have the following scenario: Snap A, B & C provide the slot “assets” using the content interface, allowing Slot X to access the files in the assets folder on the slot side.
snap connections shows:
Interface Plug Slot Notes content[assets] snapx:assets snapA:assets manual content[assets] snapx:assets snapB:assets manual content[assets] snapx:assets snapC:assets manual
Let’s assume that I connect Snap A,B,C (in this order), in my use case resulting in the directories $SNAP_DATA/assets (Snap A), $SNAP_DATA/assets-2 (Snap B), $SNAP_DATA/assets-3 (Snap C) being created.
I have an application running inside Snap X, which uses data provided in $SNAP_DATA/assets, $SNAP_DATA/assets-2, and so on.
Now I disconnect Snap B, which will result that $SNAP_DATA/assets-3 will now be removed and Snap A and Snap C will now use $SNAP_DATA/assets and $SNAP_DATA/assets-2 (most likely in this order, but that to my knowledge is not guaranteed).
Long story short: Because of this effect, I need a cleanup script which updates the configuration of my application running inside Snap X so that the configuration now points to the correct files in the place.
Unfortunately, I can’t execute the cleanup script inside the disconnect-plug-assets hook, because at this time the “outdated” directory still exists. Because of that I tried using the unprepare-plug-assets, but it seems like the hook is never called.
Is there an alternative?
Switching the mechanism (Snap X provides a Slot to which Snap A, B, C connect) is not possible in my use case.