Select a folder using a folder dialog

I would like to open a folder dialog so that I can select a folder and use its path in my software. Ideally, this class method for selecting a folder should be OS independent.

I have attempted to do this using the ofFileDialogResult class method but it doesn’t seem to allow me to select a folder, only individual files.

What I need would be akin to ofFolderDialogResult rather than ofFileDialogResult is such a class method existed - but I cannot find anything like that in the API.

Can you help?

Thanks.

You need to set flag bFolderSelection to true.

ofFileDialogResult result = ofSystemLoadDialog("select input folder", true);
if (result.bSuccess) {
	inputPath = result.getPath();
    // your code
}
3 Likes

Thank you!