Moving files to Trash Can in Linux using C++

Viewed 2352

I'm trying to move (delete) a file to a Trash Can (in Linux) using C++ (also using QT4 for GUI). Unfortunately it seems to be quite difficult to do so and as far as I can tell there isn't a unified API for it.

I would like for my application to run not only on KDE but on GNOME, Xfce and other Linux desktop environments. That's why I'm searching for a more universal approach.

The best I could find so far is:

  • send2trash - but that's using Python/QT4 and not C++/QT4
  • trash-cli - this has the drawback of being a stand alone command line program and not a library

I would be happy with any approach that requires as little desktop environment specific code as possible. Or in other words that's as much independent from KDE/GNOME/Xfce components as possible.

Any help in finding a solution (if there even is one) would be greatly appreciated.

3 Answers
Related