2
0
Эх сурвалжийг харах

get_keys_dir: legacy=False default

Thomas Waldmann 2 жил өмнө
parent
commit
1d4810af23

+ 1 - 1
src/borg/helpers/fs.py

@@ -71,7 +71,7 @@ def join_base_dir(*paths, **kw):
     return None if base_dir is None else os.path.join(base_dir, *paths)
     return None if base_dir is None else os.path.join(base_dir, *paths)
 
 
 
 
-def get_keys_dir(*, legacy=True):
+def get_keys_dir(*, legacy=False):
     """Determine where to repository keys and cache"""
     """Determine where to repository keys and cache"""
     keys_dir = os.environ.get("BORG_KEYS_DIR")
     keys_dir = os.environ.get("BORG_KEYS_DIR")
     if keys_dir is None:
     if keys_dir is None:

+ 6 - 3
src/borg/testsuite/helpers.py

@@ -672,9 +672,12 @@ def test_get_keys_dir(monkeypatch):
     monkeypatch.delenv("BORG_BASE_DIR", raising=False)
     monkeypatch.delenv("BORG_BASE_DIR", raising=False)
     if is_win32:
     if is_win32:
         monkeypatch.delenv("BORG_KEYS_DIR", raising=False)
         monkeypatch.delenv("BORG_KEYS_DIR", raising=False)
-        assert get_keys_dir(legacy=False) == os.path.join(
-            os.path.expanduser("~"), "AppData", "Local", "borg", "borg", "keys"
-        )
+        assert get_keys_dir() == os.path.join(os.path.expanduser("~"), "AppData", "Local", "borg", "borg", "keys")
+    elif is_darwin:
+        monkeypatch.delenv("BORG_KEYS_DIR", raising=False)
+        assert get_keys_dir() == os.path.join(os.path.expanduser("~"), "Library", "Preferences", "borg", "keys")
+        monkeypatch.setenv("BORG_KEYS_DIR", "/var/tmp")
+        assert get_keys_dir() == "/var/tmp"
     else:
     else:
         monkeypatch.delenv("XDG_CONFIG_HOME", raising=False)
         monkeypatch.delenv("XDG_CONFIG_HOME", raising=False)
         monkeypatch.delenv("BORG_KEYS_DIR", raising=False)
         monkeypatch.delenv("BORG_KEYS_DIR", raising=False)