From: Corey Quinn Date: Mon, 23 May 2011 02:06:14 +0000 (-0700) Subject: Test conditions for ~/.config X-Git-Url: https://git.madduck.net/code/vcsh.git/commitdiff_plain/2db7eb61c0ba0c9c48f6a0a1b08064c10a6dec8a?hp=--cc Test conditions for ~/.config --- 2db7eb61c0ba0c9c48f6a0a1b08064c10a6dec8a diff --git a/vcsh b/vcsh index 62310a7..3d08f22 100755 --- a/vcsh +++ b/vcsh @@ -4,6 +4,18 @@ SELF=$(basename $0) [ -z $XDG_CONFIG_HOME ] && XDG_CONFIG_HOME="$HOME/.config" +for dir in $XDG_CONFIG_HOME $XDG_CONFIG_HOME/vcsh $XDG_CONFIG_HOME/vcsh/repo.d +do + + if [ ! -d $dir ]; then + if [ -e $dir ]; then + echo "$SELF: error: $dir exists but is not a directory" >&2 + return 2 + else + mkdir $dir || (echo "$SELF: error: could not create $dir" >&2; return 2) + fi + fi +done VCSH_BASE="$XDG_CONFIG_HOME/vcsh/repo.d" help() {