Look for ~/.config/avrdude/avrduce.rc configuration file (#1131)

* Look for ~/.config/avrdude/config configuration file

Traditionally per-user configuration files have been placed
in user's home directory with their names beginnig with a dot
to hide them from some tools like ls(1). However, the number
of programs following this convention have grown over time
to the point where the number of hidden files becomes inconvenient to
some users. For this reason the XDG Base Directory Specification[1]
specifies an alternate place to store configuration files under
~/.config directory.

This patch enables avrdude to look for ~/.config/avrdude/config
configuration file, if ~/.avrduderc doesn't exist.

[1] https://specifications.freedesktop.org/basedir-spec/basedir-spec-0.8.html

* Safely concatenate directories and configurations files and minor changes in docs

* Make stats variable available for WIN32 again in main.c

* Utilise full usr_config[] array space

* Check for xdg-style avrdude.rc file first before fallback ~/.avrduderc

Co-authored-by: Stefan Rueger <stefan.rueger@urclocks.com>
This commit is contained in:
steelman
2022-10-23 22:52:54 +02:00
committed by GitHub
parent b864d7e73a
commit 34fa2faba5
5 changed files with 59 additions and 29 deletions

View File

@@ -1714,21 +1714,24 @@ AVRDUDE reads a configuration file upon startup which describes all of
the parts and programmers that it knows about. The advantage of this is
that if you have a chip that is not currently supported by AVRDUDE, you
can add it to the configuration file without waiting for a new release
of AVRDUDE. Likewise, if you have a parallel port programmer that is
not supported by AVRDUDE, chances are good that you can copy and
existing programmer definition, and with only a few changes, make your
programmer work with AVRDUDE.
of AVRDUDE. Likewise, if you have a parallel port programmer that is
not supported, chances are that you can copy an
existing programmer definition and, with only a few changes, make your
programmer work.
AVRDUDE first looks for a system wide configuration file in a platform
dependent location. On Unix, this is usually
@code{/usr/local/etc/avrdude.conf}, while on Windows it is usually in the
same location as the executable file. The name of this file can be
changed using the @option{-C} command line option. After the system wide
configuration file is parsed, AVRDUDE looks for a per-user configuration
@code{/usr/local/etc/avrdude.conf}, whilst on Windows it is usually in the
same location as the executable file. The full name of this file can be
specified using the @option{-C} command line option. After parsing the system wide
configuration file, AVRDUDE looks for a per-user configuration
file to augment or override the system wide defaults. On Unix, the
per-user file is @code{.avrduderc} within the user's home directory. On
Windows, this file is the @code{avrdude.rc} file located in the same
directory as the executable.
per-user file is @code{$@{XDG_CONFIG_HOME@}/avrdude/avrdude.rc}, whereas
if @code{$@{XDG_CONFIG_HOME@}} is either not set or empty,
@code{$@{HOME@}/.config/} is used instead. If that does not exists
@code{.avrduderc} within the user's home directory is used. On Windows,
this file is the @code{avrdude.rc} file located in the same directory as
the executable.
@menu
* AVRDUDE Defaults::