Getting currently selected folder from Content Browser in c++?

In “ContentBrowserDelegates.h” there is this delegate:



/** Called when a path is selected in the path picker */
DECLARE_DELEGATE_OneParam(FOnPathSelected, const FString& /*Path*/);


Subscribe to that event.
Whenever user selects a folder it will return to your subscribed function path to the folder selected.

The problem with that is the delegate instance “OnPathSelected” is within a struct called “FPathPickerConfig” then only way to get a config is declaring your own to then pass it as a reference to:



*virtual TSharedRef<class SWidget> CreatePathPicker(const FPathPickerConfig& PathPickerConfig)


That is Slate code, they expect you to create your own panel and setup a Slate Widget for it with your own *FPathPickerConfig *struct as param.

Inside “SContentBrowser.cpp” you can see how they subscribe a function to their FPathPickerConfig:



TSharedRef<SWidget> SContentBrowser::GetPathPickerContent()
{
    FPathPickerConfig PathPickerConfig;

    //......

**  PathPickerConfig.OnPathSelected** = FOnPathSelected::CreateSP(this, &SContentBrowser::PathPickerPathSelected);
    //.......