X-Git-Url: https://code.kerkeslager.com/?p=dotfiles;a=blobdiff_plain;f=.bashrc;h=399963c117714636ca19b1f8a8a0f43a70e098da;hp=a8ebce5e34c8d224fdf0f5a8e7b3b8b8269ae5d2;hb=307e5de920cd74dc9d27e35a65aa47f3f8103c46;hpb=2d913d041f48cb31c883795caa290f818d42eec6 diff --git a/.bashrc b/.bashrc index a8ebce5..399963c 100644 --- a/.bashrc +++ b/.bashrc @@ -95,12 +95,16 @@ get_env() { fi } +get_absolute_path() { + python3 -c "import os; print(os.path.realpath('$1'))" +} + on_prompt() { # Load a virtualenv environment if it exists in a file named .env env_folder=$(get_env $(pwd)) if [ -d "$env_folder" ] ; then - if [[ $VIRTUAL_ENV != $env_folder ]] ; then + if [[ $VIRTUAL_ENV != $(get_absolute_path $env_folder) ]] ; then echo "Activating env '$env_folder'" source "$env_folder/bin/activate" fi