#!/bin/bash

#创建log文件夹
logpath="$HOME/.Wind/com.wind.api/logs"

if [ ! -d $logpath ];
then
    mkdir -p $logpath;
    chmod a+rw $logpath;
fi

conpath="$HOME/.Wind/com.wind.api/Resources"
if [ ! -d $conpath ];
then
    mkdir -p $conpath;
    chmod a+rw $conpath;
fi

for path in $*
do
    pythonPath=`which $path`;
    pythonver=`$pythonPath -c 'import site; print(site.getusersitepackages())'`;
    if [ $? == 0 ]
    then
        echo $pythonver
        mkdir -p $pythonver
        if [ -d $pythonver ]
        then
            if [ -f "$pythonver/WindPy.py" ];
            then
                rm -f $pythonver/WindPy.py;
                rm -f $pythonver/WindPy.pyc;
            fi
            ln -sf /opt/apps/com.wind.wft/files/com.wind.api/python/WindPy.py ${pythonver};
        fi
    fi
done
