Esempio n. 1
0
def test_downloads_dir_not_created(monkeypatch, tmpdir):
    """Make sure ~/Downloads is not created."""
    download_dir = tmpdir / 'Downloads'
    monkeypatch.setenv('HOME', str(tmpdir))
    # Make sure xdg-user-dirs.dirs is not picked up
    monkeypatch.delenv('XDG_CONFIG_HOME', raising=False)
    standarddir._init_dirs()
    assert standarddir.download() == str(download_dir)
    assert not download_dir.exists()
Esempio n. 2
0
def test_downloads_dir_not_created(monkeypatch, tmpdir):
    """Make sure ~/Downloads is not created."""
    download_dir = tmpdir / 'Downloads'
    monkeypatch.setenv('HOME', str(tmpdir))
    # Make sure xdg-user-dirs.dirs is not picked up
    monkeypatch.delenv('XDG_CONFIG_HOME', raising=False)
    standarddir._init_dirs()
    assert standarddir.download() == str(download_dir)
    assert not download_dir.exists()
Esempio n. 3
0
def download_dir():
    """Get the download directory to use."""
    directory = config.get('storage', 'download-directory')
    remember_dir = config.get('storage', 'remember-download-directory')

    if remember_dir and last_used_directory is not None:
        return last_used_directory
    elif directory is None:
        return standarddir.download()
    else:
        return directory
Esempio n. 4
0
def download_dir():
    """Get the download directory to use."""
    directory = config.get('storage', 'download-directory')
    remember_dir = config.get('storage', 'remember-download-directory')

    if remember_dir and last_used_directory is not None:
        return last_used_directory
    elif directory is None:
        return standarddir.download()
    else:
        return directory
Esempio n. 5
0
def _path_info():
    """Get info about important path names.

    Return:
        A dictionary of descriptive to actual path names.
    """
    return {
        'config': standarddir.config(),
        'data': standarddir.data(),
        'system_data': standarddir.system_data(),
        'cache': standarddir.cache(),
        'download': standarddir.download(),
        'runtime': standarddir.runtime(),
    }
Esempio n. 6
0
def _path_info():
    """Get info about important path names.

    Return:
        A dictionary of descriptive to actual path names.
    """
    return {
        'config': standarddir.config(),
        'data': standarddir.data(),
        'system_data': standarddir.system_data(),
        'cache': standarddir.cache(),
        'download': standarddir.download(),
        'runtime': standarddir.runtime(),
    }
Esempio n. 7
0
def download_dir():
    """Get the download directory to use."""
    directory = config.val.downloads.location.directory
    remember_dir = config.val.downloads.location.remember

    if remember_dir and last_used_directory is not None:
        ddir = last_used_directory
    elif directory is None:
        ddir = standarddir.download()
    else:
        ddir = directory

    try:
        os.makedirs(ddir)
    except FileExistsError:
        pass

    return ddir
Esempio n. 8
0
def download_dir():
    """Get the download directory to use."""
    directory = config.val.downloads.location.directory
    remember_dir = config.val.downloads.location.remember

    if remember_dir and last_used_directory is not None:
        ddir = last_used_directory
    elif directory is None:
        ddir = standarddir.download()
    else:
        ddir = directory

    try:
        os.makedirs(ddir, exist_ok=True)
    except OSError as e:
        message.error("Failed to create download directory: {}".format(e))

    return ddir
Esempio n. 9
0
def download_dir():
    """Get the download directory to use."""
    directory = config.val.downloads.location.directory
    remember_dir = config.val.downloads.location.remember

    if remember_dir and last_used_directory is not None:
        ddir = last_used_directory
    elif directory is None:
        ddir = standarddir.download()
    else:
        ddir = directory

    try:
        os.makedirs(ddir)
    except FileExistsError:
        pass

    return ddir
Esempio n. 10
0
def download_dir():
    """Get the download directory to use."""
    directory = config.val.downloads.location.directory
    remember_dir = config.val.downloads.location.remember

    if remember_dir and last_used_directory is not None:
        ddir = last_used_directory
    elif directory is None:
        ddir = standarddir.download()
    else:
        ddir = directory

    try:
        os.makedirs(ddir, exist_ok=True)
    except OSError as e:
        message.error("Failed to create download directory: {}".format(e))

    return ddir
Esempio n. 11
0
def _download_dir():
    """Get the download directory to use."""
    directory = config.get('storage', 'download-directory')
    if directory is None:
        directory = standarddir.download()
    return directory
Esempio n. 12
0
def _download_dir():
    """Get the download directory to use."""
    directory = config.get('storage', 'download-directory')
    if directory is None:
        directory = standarddir.download()
    return directory