Esempio n. 1
0
def getResourceDirs():
    """ getResourceDirs()
    Get the directories to the resources: (pyzoDir, appDataDir, appConfigDir).
    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, appConfigDir = paths.appdata_dir("pyzo",
                                                 roaming=True,
                                                 macAsLinux=True)

    # Create tooldir if necessary
    toolDir = os.path.join(appDataDir, "tools")
    os.makedirs(toolDir, exist_ok=True)

    return pyzoDir, appDataDir, appConfigDir
Esempio n. 2
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