900128189b30f4341f240daf2ed5d1e766a8aef8

Author
Michael Aquilina <michaelaquilina@gmail.com>
Committer
Michael Aquilina <michaelaquilina@gmail.com>
Date

Message

fix: correctly determine virtualenv paths for poetry on MacOSX

Diff

 1diff --git a/autoswitch_virtualenv.plugin.zsh b/autoswitch_virtualenv.plugin.zsh
 2index c27a2ab1c81123c7b367b8ca4bf2282473a688b9..e6362c6c28870eed63a96213d1c5c9bcb6eaa50b 100644
 3--- a/autoswitch_virtualenv.plugin.zsh
 4+++ b/autoswitch_virtualenv.plugin.zsh
 5@@ -144,7 +144,14 @@ function _activate_poetry() {
 6     # if env list is empty, then no environment exists that can be activated
 7     name="$(poetry env list | cut -d' ' -f1)"
 8     if [[ -n "$name" ]]; then
 9-        local venv_path="$HOME/.cache/pypoetry/virtualenvs/$name"
10+        local venv_path
11+        # Temporary work around until we figure out a better way to
12+        # correctly determine the location of virtualenvs in poetry
13+        if [[ "$(uname)" == "Darwin" ]]; then
14+            venv_path="$HOME/Library/Caches/pypoetry/virtualenvs/$name"
15+        else
16+            venv_path="$HOME/.cache/pypoetry/virtualenvs/$name"
17+        fi
18         _maybeworkon "$venv_path" "poetry"
19         return 0
20     fi