[Portland] xdg-desktop testing
Bryce Harrington
bryce at osdl.org
Tue Jun 13 15:27:42 PDT 2006
Tom,
Here's some preliminary test code I worked on a while back. Might be
useful for reference when creating the xdg-desktop test case.
Bryce
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 01_desktop_file.sh
Type: application/x-sh
Size: 1325 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/portland/attachments/20060613/0b8db3e4/01_desktop_file.sh
-------------- next part --------------
#!/bin/bash
# Copyright 2005 Open Source Development Labs
# Distributed under the terms of the GNU General Public License
# This script locates a data or config file within the XDG directory paths
# XDG Base Directory Specification:
# http://standards.freedesktop.org/basedir-spec/latest/ar01s02.html
XDG_DATA_HOME=${XDG_DATA_HOME:-$HOME/.local/share}
XDG_CONFIG_HOME=${XDG_DATA_CONFIG:-$HOME/.config}
XDG_DATA_DIRS=${XDG_DATA_DIRS:-/usr/local/share:/usr/share}
XDG_CONFIG_DIRS=${XDG_CONFIG_DIRS:-/etc/xdg}
XDG_CACHE_HOME=${XDG_CACHE_HOME:-$HOME/.cache}
case $1
in
-D) search_path="$XDG_DATA_DIRS"
;;
-d) search_path="$XDG_DATA_HOME:$XDG_DATA_DIRS"
;;
-C) search_path="$XDG_CONFIG_DIRS"
;;
-c) search_path="$XDG_CONFIG_HOME:$XDG_CONFIG_DIRS"
;;
esac
item="$2"
if [ -z $search_path -o -z $2 ]; then
echo "Usage: $0 [-d|-D|-c|-C] <subdir/filename>"
exit -1
fi
for path in `echo $search_path | sed -e "s/:/ /g"`;
do
if [ -e $path/$item ]; then
echo "$path/$item"
exit 0
fi
done
exit 1
More information about the Portland
mailing list