Storage_writable or a better place to store files for an extension?

I would like to cache some files for an extension. The idea is to have updates on data that would evolve to show options to the user. My question is if a directory under Storage_writable is a good place, or, there is a better one I should look at. The idea is that the data can be used when:

  • there are updates for data without needing to update the extension and
  • the extension is updated the data should survive and possible to be reused by the next version of the extension.

I understand that using thePathSettings works no matter which OS is being run. In this regard, something similar to $XDG_CACHE_HOME in LibreOffice is what I would be looking for, but multiplatform.

Related to this, I would like to know how can I remove data from that directory when the extension is removed by the user, in order to free and recover the space. Is there maybe a kind of hook or postaction when removing and/or installing an extension?

Why not simply use Your-extension-folder itself?
according to your previous posts, you may use Path( __file__ ).parent

Because you can always find yourself in a shared extension state :slight_smile: - i.e., your extension may be installed in a read-only place.

Yes, I hadn’t thought of that possibility!
Is there any way to tell the extension-machinery: »if you remove x remove also y in another place«?

or lets rephrase to: … »before remove Extension.x execute the remove_my_config_somewhere.py inside the Extension.x -folder«