Search code examples
linuxubuntuinternationalizationgnome

How to obtain the path of Desktop in gnome


I am using gnome/Ubuntu-10.10 in Chinese language and the desktop path is not "~/Desktop" but "~/XXXX" where XXXX stands for the Chinese translation of "Desktop". So, how to write code to obtain the proper path of desktop regardless of the system language? I noticed Qt SDK properly added a shortcut on the desktop so I guess there is a way. Thanks a lot!


Solution

  • I have not tested yet, but try echo echo ${XDG_DESKTOP_DIR:-$HOME/Desktop}, this cmd maybe do the work.