I\'m porting some functionality from windows to linux and I\'m finding it harder to match the functionality of SHGetKnownFolderPath in linux. Actually there is an API in gli
The status of the Linux desktop is a sad mess, especially for this kind of stuff. There are some FreeDesktop standards, but nothing close to Windows Shell APIs for both consistency and commitment to backwards compatibility.
That being said, in my experience the safest thing to do is relying on utilities from XDG, in particular xdg-user-dir
in your case (xdg utils can come in handy in other cases); nowadays they are almost universally installed, and they usually do the "right" thing. Also, many packages rely on them, so it's likely that any DE tests the integration at least on them (IOW: if someone writes configuration that breaks even xdg utils it's likely that they'll fix it; if it's out of spec garbage that happens to work with xdg utils they may not notice).
Please don't try to be too clever with this kind of stuff. Firefox tries to be clever with file associations on Linux and it's 10 years that clicking "open folder" in it opens random applications (for the record, on my box it's extremely fond of opening Gwenview; in the past it liked more FileLight).