From 64038adef2d30187c19655d61ca241140131bb7f Mon Sep 17 00:00:00 2001 From: Earnestly Date: Mon, 4 Dec 2017 11:58:32 +0000 Subject: [PATCH] sx: create XAUTHORITY directory components We need to do this in sx as neither xauth(1) or touch(1) will create the path. Requiring the user to do this would lead to additional code on their side to account for a detail that sx already controls. There is no obvious benefit for omitting this functionality. --- sx | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/sx b/sx index db52ece..c5f433c 100755 --- a/sx +++ b/sx @@ -4,10 +4,7 @@ # requires fgconsole stty timeout xauth Xorg # I'm willing to take advantage of errexit for this script as roughly 85% of -# the error checking would take the form of: -# if ! command; then -# exit -# fi +# the error checking would just be exiting on command failure. set -o errexit cleanup() { @@ -46,7 +43,7 @@ esac cfgdir=${XDG_CONFIG_HOME:-$HOME/.config}/sx export XAUTHORITY=${XAUTHORITY:-$cfgdir/xauthority} -mkdir -p "$cfgdir" +mkdir -p "$cfgdir" "${XAUTHORITY%/*}" touch "$XAUTHORITY" trap 'cleanup "$pid"' EXIT