import string
import os
import sys
import re
###Path
User_Doc = os.environ["USERPROFILE"]
User_Doc_Path=User_Doc.replace('/','\\')
Maya_Env_Path=User_Doc_Path+'\\Documents\\maya\\2014-x64\\maya.env'
UserSetup_Path = User_Doc+'\\Documents\\maya\\2014-x64\\zh_CN\\scripts\\userSetup.py'
UserSetupDoc_Path = User_Doc+'\\Documents\\maya\\2014-x64\\zh_CN\\scripts\\'
#Write Path To maya.env
Maya_Env_Contents = "\nMAYA_PLUG_IN_PATH = E:\\YJ_maya_srcipt\\prefs\\plugins;\n"
Maya_Env_Contents += "MAYA_SHELF_PATH = E:\\YJ_maya_srcipt\\prefs\\shelves;\n"
Maya_Env_Contents += "MAYA_SCRIPT_PATH = E:\\YJ_maya_srcipt\\prefs\\scripts;\n"
Maya_Env_Contents += "XBMLANGPATH = E:\\YJ_maya_srcipt\\prefs\\icons;"
Maya_Env_Path_Judge = os.path.exists(Maya_Env_Path)
if Maya_Env_Path_Judge == 1:
MayaEnv_Write=open(Maya_Env_Path,'w')
MayaEnv_Write.truncate()
MayaEnv_Write.write(Maya_Env_Contents)
MayaEnv_Write.close()
if Maya_Env_Path_Judge != 1:
MayaEnv_Write=open(Maya_Env_Path,'w')
MayaEnv_Write.write(Maya_Env_Contents)
MayaEnv_Write.close()
#=============================================================================
#Create usersetup.py
#======================
UserSetup_Contents = 'import sys\n'
UserSetup_Contents += "sys.path.append( 'E:\YJ_maya_srcipt\prefs\scripts' )"
UserSetupDoc_PathJudge=os.path.exists(UserSetupDoc_Path)
if UserSetupDoc_PathJudge != 1:
os.makedirs(UserSetupDoc_Path)
MayaEnv_Write=open(UserSetup_Path,'w')
MayaEnv_Write.truncate()
MayaEnv_Write.write(UserSetup_Contents)
MayaEnv_Write.close()
#=========================================================================
#