getStateInformation - where is path to file?

Hello,
sorry but with xCode debugger I can’t find the path to file where state information are stored.

I suppose various hosts have various paths to that file, but let’s say Juce AudioPluginHost where it stores the file with state informations?

Is it any xml file or what?

I have problem because I have one parameter which I am almost sure I’ve never saved before, but after I call: var paramId = paramNode.getProperty("PARAM_ID");

the condition !paramId.isVoid() is always true, and I get stupid values.

Of course I can save my plugin state and see what happen, but then I am not able to get back to previous state to test it again what happen if I have file without default value. I could delete the file with state to test it again but I don’t know where the file is. And that’s why I ask.

The plugin state data is stored embedded in the host’s project file together with all the other states of the host and other plugins and there is no API for plugins to get the location of that file. But even if there was an API to get the location, each host has its own way of storing the projects. (Anyway as a user you would know the location of that file if you used the “save as” command in the host…)

If you update your getStateInformation with

ValueTree myState("params");
MemoryOutputStream memOut(destData, false);
myState.writeToStream(memOut);

and your setStateInformation with

auto newTree = ValueTree::readFromData(data, sizeInBytes);
if (newTree.isValid())
{
DBG(newTree.toXmlString())
}

You will get a nice XML text in the console where you can examine what’s inside the state file. No need to deal with the file directly.

3 Likes

Hello, great thanks for your help