From eb82e89283cfba739148cbcebe9ba26d29a54cd3 Mon Sep 17 00:00:00 2001
From: Alexander Sulfrian <alexander@sulfrian.net>
Date: Wed, 27 Jun 2012 13:39:43 +0200
Subject: bash/common: always set WORKON_HOME

---
 bashrc/common/virtualenv.sh | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

(limited to 'bashrc')

diff --git a/bashrc/common/virtualenv.sh b/bashrc/common/virtualenv.sh
index 7ba48b9..c3e0ea9 100644
--- a/bashrc/common/virtualenv.sh
+++ b/bashrc/common/virtualenv.sh
@@ -1,6 +1,13 @@
-if hash "virtualenvwrapper.sh" 2>/dev/null; then
-	source $(which virtualenvwrapper.sh)
+export WORKON_HOME="$HOME/.virtualenvs/"
+if [ ! -d "${WORKON_HOME}" ]; then
+	mkdir -p "${WORKON_HOME}"
 fi
 
-# build absolut path (needed for prompt)
-export WORKON_HOME="$(cd "${WORKON_HOME}" 2>&1 >/dev/null; pwd -P)"
+if [ -d "${WORKON_HOME}" ]; then
+	if hash "virtualenvwrapper.sh" 2>/dev/null; then
+		source $(which virtualenvwrapper.sh)
+	fi
+
+	# build absolut path (needed for prompt)
+	export WORKON_HOME="$(cd "${WORKON_HOME}" 2>&1 >/dev/null; pwd -P)"
+fi
-- 
cgit v1.2.3