I’m creating a VST3 virtual instrument and I want to ship it with some static configuration files (think: string tensions, etc.) that I want to read on my plugin’s initialization, as opposed to hardcode them.
I have managed to ensure these files are installed by adding them to smtg_target_add_plugin_snapshots but, when I read them, how do I know the file path to read from? Can I assume a working directory? Is there an API function to get the path for resources? Is there a mechanism to read bundle files with VST3 plugins? I imagine there is as most virtual instruments will ship with samples.
First use smtg_target_add_plugin_resources instead of smtg_target_add_plugin_snapshots. The following will put the files inside a folder named Configuration inside Resources directory:
Now to use those files from within the plugin you’ll need Steinberg::tchar gPath[VST_MAX_PATH] defined in dllmain.cpp or macmain.cpp. On Windows it will point to the path of your DLL e.g “path/to/MyInstrument/x86_64-win/MyInstrument.dll”. But on MacOS it will point to the path of the bundle e.g “path/to/MyInstrument.bundle”. From this point you can modify the path to access your files.
However do not fully understand @gzperra’s answer as gPath is defined statically inside dllmain.cpp or macmain.cpp, isnt’t it? So how can I access from my plugin code?