Request: StandaloneFilterWindow load last file on launch

Could you add this to the end of the StandalonePluginHolder constructor:

loadLastFile();
}

void loadLastFile()
{
if (auto* instance = JUCEApplication::getInstance())
{
    auto params = instance->getCommandLineParameterArray();
    if (params.size() == 1)
    {
        File f (params[0]);
        if (f.existsAsFile())
        {
            MemoryBlock data;
            
            if (f.loadFileAsData (data))
                processor->setStateInformation (data.getData(), (int) data.getSize());
        }
    }
    else
    {
        File f (getLastFile());
        if (f.existsAsFile())
        {
            MemoryBlock data;
            
            if (f.loadFileAsData (data))
                processor->setStateInformation (data.getData(), (int) data.getSize());
        }
    }
}
}

We already reload the state of the plug-in during initialisation. The state is loaded from the settings that you pass to the constructor of the StandaloneFilterWindow. Is this not enough?

Ah, I didn’t notice that, but it doesn’t seem to be working. savePluginState() isn’t called from anywhere.

Maybe instead change closeButtonPressed() to:

void closeButtonPressed() override
{
    pluginHolder->savePluginState();
    
    JUCEApplicationBase::quit();
}

Ahh yes, well the loadPluginState is a bit useless without that. It’s on develop now with commit 829e644.

1 Like