Beispiel #1
0
def getResourceDirs():
    """ getResourceDirs()
    Get the directories to the resources: (iepDir, appDataDir).
    Also makes sure that the appDataDir has a "tools" directory and
    a style file.
    """
    
#     # Get root of the IEP code. If frozen its in a subdir of the app dir 
#     iepDir = paths.application_dir()
#     if paths.is_frozen():
#         iepDir = os.path.join(iepDir, 'source')
    iepDir = os.path.abspath(os.path.dirname(__file__))
    if '.zip' in iepDir:
        raise RuntimeError('The IEP package cannot be run from a zipfile.')
    
    # Get where the application data is stored (use old behavior on Mac)
    # todo: quick solution until I release a new pyzolib
    try:
        appDataDir = paths.appdata_dir('iep', roaming=True, macAsLinux=True)
    except Exception:
        appDataDir = paths.appdata_dir('iep', roaming=True)
    
    # Create tooldir if necessary
    toolDir = os.path.join(appDataDir, 'tools')
    if not os.path.isdir(toolDir):
        os.mkdir(toolDir)
    
    return iepDir, appDataDir
Beispiel #2
0
def getResourceDirs():
    """ getResourceDirs()
    Get the directories to the resources: (iepDir, appDataDir).
    Also makes sure that the appDataDir has a "tools" directory and
    a style file.
    """
    
#     # Get root of the IEP code. If frozen its in a subdir of the app dir 
#     iepDir = paths.application_dir()
#     if paths.is_frozen():
#         iepDir = os.path.join(iepDir, 'source')
    iepDir = os.path.abspath(os.path.dirname(__file__))
    if '.zip' in iepDir:
        raise RuntimeError('The IEP package cannot be run from a zipfile.')
    
    # Get where the application data is stored (use old behavior on Mac)
    # todo: quick solution until I release a new pyzolib
    try:
        appDataDir = paths.appdata_dir('iep', roaming=True, macAsLinux=True)
    except Exception:
        appDataDir = paths.appdata_dir('iep', roaming=True)
    
    # Create tooldir if necessary
    toolDir = os.path.join(appDataDir, 'tools')
    if not os.path.isdir(toolDir):
        os.mkdir(toolDir)
    
    return iepDir, appDataDir
Beispiel #3
0
def getResourceDirs():
    """ getResourceDirs()
    Get the directories to the resources: (pyzoDir, appDataDir).
    Also makes sure that the appDataDir has a "tools" directory and
    a style file.
    """
    
#     # Get root of the Pyzo code. If frozen its in a subdir of the app dir 
#     pyzoDir = paths.application_dir()
#     if paths.is_frozen():
#         pyzoDir = os.path.join(pyzoDir, 'source')
    pyzoDir = os.path.abspath(os.path.dirname(__file__))
    if '.zip' in pyzoDir:
        raise RuntimeError('The Pyzo package cannot be run from a zipfile.')
    
    # Get where the application data is stored (use old behavior on Mac)
    appDataDir = paths.appdata_dir('pyzo', roaming=True, macAsLinux=True)
    
    # Create tooldir if necessary
    toolDir = os.path.join(appDataDir, 'tools')
    if not os.path.isdir(toolDir):
        os.mkdir(toolDir)
    
    return pyzoDir, appDataDir