Get root path (or path to data dir) from application?


Well-known member

I'm trying to retreive the path to the /data directory as we've got a custom mod on our server which loads up screenshots of websites. Basically I need to be able to delete screenshots from this mod and to do that need to be able to get into the /data directory.

I noticed in the /library/XenForo/Application.php file there is a '_rootdir' option however it cant be accessed from my application, and also has a value of '.' - obviously I need the actual server path (e.g /home/user/pulbic_html/).

I can do this with PHP, however was wondering if XF (or zend) has a function for this already?

Cheers :)


XenForo Developer
Staff member
In beta 2:
XenForo_Application::getInstance()->getRootDir() . '/data'

In beta 3: