libxdgmm
I think the Portland Project from freedesktop.org, is a great idea and
everyone should be supporting it in their applications.
I’ve just created a very small C++ wrapper (libxdgmm) for accessing XDG more easily. To use it, you need libxdgmm.h and libxdgmm.cpp. Just add these to your project and then use them like so:
#include <libxdgmm/libxdg.h>
int main(int argc, char** argv)
{
if (!xdg::IsInstalled()) std::cout<<"XDG is not installed"<<std::endl;
else {
std::string data;
xdg::GetDataHome(data);
std::cout<<"data=\""<<data<<"\""<<std::endl;
std::string config;
xdg::GetConfigHome(config);
std::cout<<"config=\""<<config<<"\""<<std::endl;
// Obviously these have to exist to work. You can translate the error code returned by calling xdg::GetOpenErrorString(int result);
xdg::OpenFile("/home/chris/dev/cMd3Loader.cpp");
xdg::OpenFolder("/home/chris/");
xdg::OpenURL("http://chris.iluo.net");
}
return EXIT_SUCCESS;
}
I still have to wrap some of the other functionality, such as XDG_DESKTOP_DIR
, XDG_DOCUMENTS_DIR
, XDG_MUSIC_DIR
, desktop-file-utils, xdg-desktop-menu and xdg-desktop-icon etc. I will wrap these as I need them (Or at special request). I don’t think I will be supporting xdg-screensaver or xdg-mime as I don’t have a use for them right now.