changeset 83:966d8f8f89d0

Make sure that directories exist, since not all files are in ~/
author IBBoard <dev@ibboard.co.uk>
date Thu, 15 Mar 2018 21:00:07 +0000
parents 220ca3e2e115
children b989099cde9f
files setup.sh
diffstat 1 files changed, 4 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/setup.sh	Thu Mar 15 20:59:22 2018 +0000
+++ b/setup.sh	Thu Mar 15 21:00:07 2018 +0000
@@ -6,6 +6,10 @@
 	if [ "${SOURCEFILE:0:1}" != "/" ]; then
 		SOURCEFILE=$SCRIPTPATH/$1
 	fi
+	parent_dir=$(dirname "$2")
+	if [ ! -d "$parent_dir" ]; then
+		mkdir "$parent_dir"
+	fi
 	if [ ! -e $2 ]; then
 		ln -s $SOURCEFILE $2
 	elif [ "$(readlink $2)" != "$SCRIPTPATH/$1" ]; then