Request: StandaloneFilterWindow load last file on launch


#1

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());
        }
    }
}
}

#2

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?


#3

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();
}

#4

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