Skip to content

Commit aec9b85

Browse files
committed
simplify qutebrowser_config_dirs
1 parent 2e70bd6 commit aec9b85

File tree

2 files changed

+9
-12
lines changed

2 files changed

+9
-12
lines changed

src/qbpm/paths.py

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import platform
2+
from collections.abc import Iterator
23
from pathlib import Path
34

45
from click import get_app_dir
@@ -32,14 +33,10 @@ def qutebrowser_data_dir() -> Path:
3233
return Path(get_app_dir("qutebrowser", roaming=True))
3334

3435

35-
def qutebrowser_config_dirs() -> list[Path]:
36-
# deduplicate while maintaining order
37-
return list(
38-
dict.fromkeys(
39-
[
40-
Path(get_app_dir("qutebrowser", roaming=True)),
41-
xdg_config_home() / "qutebrowser",
42-
Path.home() / ".qutebrowser",
43-
]
44-
)
45-
)
36+
def qutebrowser_config_dirs() -> Iterator[Path]:
37+
app_dir = Path(get_app_dir("qutebrowser", roaming=True))
38+
yield app_dir
39+
xdg_dir = xdg_config_home() / "qutebrowser"
40+
if xdg_dir != app_dir:
41+
yield xdg_dir
42+
yield Path.home() / ".qutebrowser"

src/qbpm/profiles.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ def find_qutebrowser_config_dir(qb_config_dir: Path | None) -> Path | None:
9292
dirs = (
9393
[qb_config_dir, qb_config_dir / "config"]
9494
if qb_config_dir
95-
else qutebrowser_config_dirs()
95+
else list(qutebrowser_config_dirs())
9696
)
9797
for config_dir in dirs:
9898
if (config_dir / config_file).exists():

0 commit comments

Comments
 (0)