Skip to content

Commit 41aa612

Browse files
committed
feat(windows): load configuration from LOCALAPPDATA as well
Issue #715
1 parent 1ac1cef commit 41aa612

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

wlc/config.py

+7-5
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
import os.path
1010
from configparser import NoOptionError, RawConfigParser
11+
from collections.abc import Generator
1112

1213
from xdg.BaseDirectory import load_config_paths
1314

@@ -40,12 +41,13 @@ def set_defaults(self):
4041
self.set(self.section, "backoff_factor", 0)
4142

4243
@staticmethod
43-
def find_configs():
44+
def find_configs() -> Generator[str]:
4445
# Handle Windows specifically
45-
if "APPDATA" in os.environ:
46-
win_path = os.path.join(os.environ["APPDATA"], "weblate.ini")
47-
if os.path.exists(win_path):
48-
yield win_path
46+
for envname in ("APPDATA", "LOCALAPPDATA"):
47+
if path := os.environ.get(envname):
48+
win_path = os.path.join(path, "weblate.ini")
49+
if os.path.exists(win_path):
50+
yield win_path
4951

5052
# Generic XDG paths
5153
yield from load_config_paths("weblate")

0 commit comments

Comments
 (0)