FileChooser, remember last selected directory


#1

Is there a way to make a FileChooser remember last selected directory? Even better, implicitely store the path in a singleton (so that it syncs accross say, plug-in instances)?

The main problem is, FileChooser doesn't seem offer a way to update initialFile at runtime (it is a constructor argument, no setters). I understand that I could re-instantiate the FileChooser after every selection, but this complicates the whole process (non RAII).

Any ideas? I'm wondering how this is meant to be done in JUCE.


#2

The FileChooser object is not designed to be re-used. You create one, use it, delete it.. I'm not sure exactly what you mean, but it doesn't sound like you're using it in the way it's intended.


#3

I re-use the fileChooser, indeed. I'll rework that part, thanks for the pointer.


#4

I've done this recently and just saved the most recent folder path as an app setting.

 

Works great.