From 7dbe4373be80568ab773baf7a6fa2a6824817e1b Mon Sep 17 00:00:00 2001 From: Jean-Pierre Martineau Date: Tue, 7 Jul 2026 20:08:06 -0400 Subject: [PATCH] Store config and data under ~/.meshterm Move the default config directory from ~/.config/meshterm (with XDG_CONFIG_HOME support) to a plain ~/.meshterm dotfolder under the OS-defined home directory. Co-Authored-By: Claude Opus 4.8 --- config.example.toml | 2 +- meshterm/core/config.py | 11 ++++------- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/config.example.toml b/config.example.toml index ba03226..5bb6068 100644 --- a/config.example.toml +++ b/config.example.toml @@ -1,5 +1,5 @@ # MeshTerm configuration. -# Copy to ~/.config/meshterm/config.toml (or pass --db / --port on the CLI). +# Copy to ~/.meshterm/config.toml (or pass --db / --port on the CLI). # # Profiles are optional. With no profile and no --port, MeshTerm discovers attached # serial devices, lets you pick one (interactively) or uses the single one present, and diff --git a/meshterm/core/config.py b/meshterm/core/config.py index eec3f17..a0caf97 100644 --- a/meshterm/core/config.py +++ b/meshterm/core/config.py @@ -1,6 +1,6 @@ """Configuration and named device profiles. -Settings are read from a TOML file (default ``~/.config/meshterm/config.toml``) and may +Settings are read from a TOML file (default ``~/.meshterm/config.toml``) and may be overridden per-invocation by CLI flags. Profiles let you alias your hardware (``yagi`` repeater, ``local`` repeater, ``observer`` bot, ``s3`` serial companion) to a serial port and defaults so commands can target them by name. @@ -22,16 +22,13 @@ else: # pragma: no cover - exercised only on 3.10 def default_config_dir() -> Path: """Return the directory MeshTerm uses for config and data. - Honors ``$XDG_CONFIG_HOME`` when set; otherwise falls back to ``~/.config``. + Resolves to ``.meshterm`` under the OS-defined home directory (``%USERPROFILE%`` + on Windows, ``$HOME`` on Unix), as reported by :meth:`Path.home`. Returns: The resolved configuration directory path (not guaranteed to exist). """ - import os - - base = os.environ.get("XDG_CONFIG_HOME") - root = Path(base) if base else Path.home() / ".config" - return root / "meshterm" + return Path.home() / ".meshterm" @dataclass(slots=True)