There's not really an API but I did find out how to do it and found an MIT licensed source file to make it happen so I'll close this pull request and work on that over the weekend.  I will notify Juliana about the license and update the wiki. It's RedHat software but MIT license.

http://cgit.freedesktop.org/xdg/xdg-user-dirs/