Preset Saving

I’m trying to add a preset manager to my plugin, but whenever I try to create a preset (or create the preset directory), it fails to do so. The plugin doesn’t crash, it just doesn’t create the preset file. Has anyone else encountered this, and what might I be doing wrong?

What is the value of defaultDirectory?

const File PresetManager::defaultDirectory{ File::getSpecialLocation(
File::SpecialLocationType::userDocumentsDirectory)
.getChildFile(ProjectInfo::companyName)
.getChildFile(ProjectInfo::projectName)
};

But what is that when you print it out?

And does this directory exist?

You can set a breakpoint on juce::XmlElement::writeTo and step through it to see at which stage the writing fails.

Looks like it fails on opening the FileOutputStream. The defaultDirectory is just my user documents folder; it’s used in other parts of the program just fine, such as when I open the FileChooser to save a preset.