[chirp_devel] XDG-compliant patch for Linux
Kian Kasad
Sat Jun 27 16:37:46 PDT 2020
I created a simple patch to move the chirp data directory from ~/.chirp
to the directory pointed to by $XDG_CONFIG_HOME. It uses ~/.config/chirp
as a fallback if $XDG_CONFIG_HOME is not set.
I don't know how to use mercurial, so I've attached the patch here in
hopes that someone might help add this to the upstream repo.
This command should apply the patch with no manual intervention:
patch -p1 -i chirp-xdgconfig.diff
Thanks,
Kian Kasad
-------------- next part --------------
--- a/chirp/platform.py 2020-06-25 22:08:20.101976074 -0700
+++ b/chirp/platform.py 2020-06-25 22:10:19.398639875 -0700
@@ -275,8 +275,17 @@ class UnixPlatform(Platform):
"""A platform module suitable for UNIX systems"""
def __init__(self, basepath):
if not basepath:
- basepath = os.path.abspath(os.path.join(self.default_dir(),
- ".chirp"))
+ try:
+ basepath = os.path.abspath(os.path.join(
+ os.environ["XDG_CONFIG_HOME"],
+ "chirp"
+ ))
+ except KeyError:
+ basepath = os.path.abspath(os.path.join(
+ self.default_dir(),
+ ".config",
+ "chirp"
+ ))
if not os.path.isdir(basepath):
os.mkdir(basepath)
More information about the chirp_devel
mailing list