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()
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
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(), }
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
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
def _download_dir(): """Get the download directory to use.""" directory = config.get('storage', 'download-directory') if directory is None: directory = standarddir.download() return directory