Skip to content

Commit

Permalink
match new profile directories on macOS as well
Browse files Browse the repository at this point in the history
  • Loading branch information
patzm committed Dec 18, 2023
1 parent 404d07b commit 54a1711
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions patzm/scripts/sync_firefox_dictionary.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import logging
import pathlib
import platform
import re
from typing import Dict, List, Optional, Set, Union

import click
Expand Down Expand Up @@ -239,9 +240,14 @@ def sync_all(check_firefox: bool):
exit(1)

if platform.system() == "Darwin":
config_dir = pathlib.Path.home() / "Library/Application Support/Firefox/Profiles"
config_dir = pathlib.Path.home() / "Library/Application Support/Firefox"
config_dirs = [config_dir, config_dir / "Profiles"]
else:
config_dir = pathlib.Path.home() / ".mozilla/firefox"

for profile_dir in config_dir.iterdir():
_sync(file_path=profile_dir / "persdict.dat")
config_dirs = [pathlib.Path.home() / ".mozilla/firefox"]

profile_dir_pattern = re.compile(r"(profile-[A-Za-z0-9]+)|([A-Za-z0-9]+\.default(-release)?)")
for config_dir in config_dirs:
for profile_dir in config_dir.iterdir():
match = profile_dir_pattern.match(profile_dir.name)
if match:
_sync(file_path=profile_dir / "persdict.dat")

0 comments on commit 54a1711

Please sign in to comment.