[Feature Request] Data directory for custom scripts to store state
Describe the solution you'd like
One of my scripts needs to store some state between Firebot sessions. I would like to stash this file in a reasonable location without making the user configure a file path -- the user will not ever be interacting directly with this file so it's more convenient just to have this happen behind the scenes. I think the most reasonable place to store this file is under the Firebot profile directory.
After discussing this in the Discord, the agreed solution is to create script-data/{normalized script name} under the profile directory and make this available in a scriptDataDir property in buildModules.
Additional context
Alternatives considered (some discussed in Discord):
- Copy the logic from
copy-build.jsinto my script - Dennis pointed me to working backwards from globals (
modules.path.join(SCRIPTS_DIR, '..', 'db', 'userSfx.db') - Oshimia suggested the clever approach of writing the persistent data as metadata for the streamer
My original proposal was to allow getPathInProfile of profileManager to be exposed to custom scripts. However there were some concerns about this, and the new solution that's described here is safer and easier!