Skip to content

Commit 54a1711

Browse files
committed
match new profile directories on macOS as well
1 parent 404d07b commit 54a1711

1 file changed

Lines changed: 11 additions & 5 deletions

File tree

patzm/scripts/sync_firefox_dictionary.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import logging
44
import pathlib
55
import platform
6+
import re
67
from typing import Dict, List, Optional, Set, Union
78

89
import click
@@ -239,9 +240,14 @@ def sync_all(check_firefox: bool):
239240
exit(1)
240241

241242
if platform.system() == "Darwin":
242-
config_dir = pathlib.Path.home() / "Library/Application Support/Firefox/Profiles"
243+
config_dir = pathlib.Path.home() / "Library/Application Support/Firefox"
244+
config_dirs = [config_dir, config_dir / "Profiles"]
243245
else:
244-
config_dir = pathlib.Path.home() / ".mozilla/firefox"
245-
246-
for profile_dir in config_dir.iterdir():
247-
_sync(file_path=profile_dir / "persdict.dat")
246+
config_dirs = [pathlib.Path.home() / ".mozilla/firefox"]
247+
248+
profile_dir_pattern = re.compile(r"(profile-[A-Za-z0-9]+)|([A-Za-z0-9]+\.default(-release)?)")
249+
for config_dir in config_dirs:
250+
for profile_dir in config_dir.iterdir():
251+
match = profile_dir_pattern.match(profile_dir.name)
252+
if match:
253+
_sync(file_path=profile_dir / "persdict.dat")

0 commit comments

Comments
 (0)