get_config_dir: legacy=False default

This commit is contained in:
Thomas Waldmann 2023-02-04 00:06:31 +01:00
parent ebcda6f0a5
commit b06dd1c66c
No known key found for this signature in database
GPG Key ID: 243ACFA951F78E01
2 changed files with 7 additions and 2 deletions

View File

@ -130,7 +130,7 @@ def get_cache_dir(*, legacy=False):
return cache_dir
def get_config_dir(*, legacy=True):
def get_config_dir(*, legacy=False):
"""Determine where to store whole config"""
# Get config home path

View File

@ -614,7 +614,12 @@ def test_get_config_dir(monkeypatch):
monkeypatch.delenv("BORG_BASE_DIR", raising=False)
if is_win32:
monkeypatch.delenv("BORG_CONFIG_DIR", raising=False)
assert get_config_dir(legacy=False) == os.path.join(os.path.expanduser("~"), "AppData", "Local", "borg", "borg")
assert get_config_dir() == os.path.join(os.path.expanduser("~"), "AppData", "Local", "borg", "borg")
elif is_darwin:
monkeypatch.delenv("BORG_CONFIG_DIR", raising=False)
assert get_config_dir() == os.path.join(os.path.expanduser("~"), "Library", "Preferences", "borg")
monkeypatch.setenv("BORG_CONFIG_DIR", "/var/tmp")
assert get_config_dir() == "/var/tmp"
else:
monkeypatch.delenv("XDG_CONFIG_HOME", raising=False)
monkeypatch.delenv("BORG_CONFIG_DIR", raising=False)