Hi All,
I install the RosBE on my machine(gentoo linux + kde )
when I successfully ran the RosBE-Builder.sh, and
then the createshortcut.sh to create a short cut on desktop,
it failed.
It is cause by that createshortcut.sh assume that here exist
a $HOME/Desktop, but I haven't a desktop folder in $HOME
At the very top of script[RosBE-Unix-2.1/scripts/createshortcut.sh]
there is :
----- snippt -----
# Constants
DEFAULT_SHORTCUT_DIR="$HOME/Desktop"
----- snippt -----
It makes an ill-conceived assumption, because :
1) No Desktop folder must be guaranteed, though KDE/GNOME
provides it by default, but when I install it by my own, it doesn't.
2) Even it exsits ,the name of the Desktop folder is locale-specified,
for example, it may be in chinese word form.
So a portable, robust way is :
* Probe the folder use a tool called * xdg-user-dir, *provided
the
freedesktop.org, which is shipped with most
distro compliant with
freedesktop.org.(xdg-user-dirs<http://freedesktop.org/wiki/Software/xdg-…
* If there isn't this tool or it fails to probe
the folder, we shall check the $HOME/Desktop explictly; if it fails
again, we should create it
manually.
Here is my fix:
XDG_USER_DIR_BIN=`which xdg-user-dir` && \
DEFAULT_SHORTCUT_DIR=`$XDG_USER_DIR_BIN DESKTOP`
if test -z ${DEFAULT_SHORTCUT_DIR} ; then
[ -d $HOME/Desktop ] && DEFAULT_SHORTCUT_DIR=$HOME/Desktop
else
mkdir $HOME/Desktop && DEFAULT_SHORTCUT_DIR=$HOME/Desktop