
# Inspired from http://www.linuxfromscratch.org/blfs/view/svn/postlfs/profile.html
# and ported to zsh.
# Functions to help us manage paths.  Second argument is the name of the
# list variable to be modified
listremove () {
        local PATHVARIABLE=${2}
        local array_helper
        local scalar_helper=${(P)PATHVARIABLE}

        typeset -T scalar_helper array_helper

        array_helper=(${array_helper[@]:#${1}})

        export $PATHVARIABLE=${scalar_helper}
}

listprepend () {
        local PATHVARIABLE=${2}
        local array_helper
        local scalar_helper=${(P)PATHVARIABLE}

        typeset -T scalar_helper array_helper

        array_helper=(${1} ${array_helper})

        export $PATHVARIABLE=${scalar_helper}
}

listappend () {
        local PATHVARIABLE=${2}
        local array_helper
        local scalar_helper=${(P)PATHVARIABLE}

        typeset -T scalar_helper array_helper

        array_helper+=(${1})

        export $PATHVARIABLE=${scalar_helper}
}
if [[ ! -z $COMSPEC ]];
then
    listremove "$CONDA_PREFIX/Library\share\yarp" YARP_DATA_DIRS
    listremove "$CONDA_PREFIX/Library\share" XDG_DATA_DIRS
else
    listremove "$CONDA_PREFIX/share/yarp" YARP_DATA_DIRS
    listremove "$CONDA_PREFIX/share" XDG_DATA_DIRS
fi;