import os
XXX="VNR"

def GetDataDir(addXXX=False):
    try:
        basepath=os.path.join(os.sep,"data")
    except:
        basepath=""

    if not os.path.exists( basepath ):
        try:
            basepath=os.path.join( os.environ["UTSUSEMI_DATA_DIR"] )
        except:
            raise UserWarning("Data Path is not found")

    if addXXX:
        basepath = os.path.join( basepath, XXX )
    
    return basepath

def GetUserDir():
    try:
        ret = os.path.join(os.sep,"usr","local","mlf",XXX)
    except:
        ret=""
    
    if not os.path.exists( ret ):
        if "UTSUSEMI_USR_DIR" in os.environ:
            ret = os.environ["UTSUSEMI_USR_DIR"]
        else:
            ret = ""
    if ret=="":
        raise UserWarning("UserDir is not found.")

    return ret
    
def GetInstCode():
    try:
        InstCode = XXX
    except:
        if "UTSUSEMI_INST_CODE" in os.environ:
            InstCode = os.environ["UTSUSEMI_INST_CODE"]
        else:
            InstCode = ""

    if InstCode=="":
        raise UserWarning("InstCode is not set")

    return InstCode
