Download

Get current content browser path?

How can I determine what path/folder the user is currently in, in the content browser?

Essentially I would like to have a custom menu command and when fired that command’s code needs to determine the current content browser path.

I’ve been digging and digging but can’t find any way to do this :frowning:

I did find that SContentBrowser has a function to get the current path, however that is private so I couldn’t use it even if I could figure out how to get a pointer to the active slate widget, which I can’t. I might be able to get it from the SAssetView widget, maybe, if again I could figure out how to get a pointer to it.

Is there a way to get a pointer to an existing editor slate widget somehow?

For future posterity if anyone else tries to do this. I finally managed to do what I needed, but in a very roundabout way.

The ContentBrowser module has a delegate that fires whenever the content path is changed. GetOnAssetPathChanged()

What I ended up doing was creating a new class derived from UObject whose sole purpose was to monitor that path changed delegate and keep track of what the current path is, and provide it when requested. Like I said very roundabout but it works.

If anyone from Epic sees this though, I would highly suggest that IContentBrowserSingleton have a function that simply returns the current path. The SContentBrowser actually has such a function but it is private.