From 30d66bcebc27a1cdcbad39ddbeeaf047da6cc1dd Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sun, 10 Apr 2016 17:10:20 +0200 Subject: fixing #4386: use more sane configuration and data file structure --- src/util/Makefile.am | 9 +++++++++ src/util/paths.conf | 29 +++++++++++++++++++++++++++++ src/util/util.c | 27 --------------------------- 3 files changed, 38 insertions(+), 27 deletions(-) create mode 100644 src/util/paths.conf (limited to 'src/util') diff --git a/src/util/Makefile.am b/src/util/Makefile.am index 54f0f0e38..f52bc81c6 100644 --- a/src/util/Makefile.am +++ b/src/util/Makefile.am @@ -6,6 +6,15 @@ if USE_COVERAGE XLIB = -lgcov endif + +pkgcfgdir = $(prefix)/share/taler/config.d/ + +pkgcfg_DATA = \ + paths.conf + +EXTRA_DIST = \ + paths.conf + if WALLET_ONLY lib_LTLIBRARIES = \ libtalerutil_wallet.la diff --git a/src/util/paths.conf b/src/util/paths.conf new file mode 100644 index 000000000..03febb0e4 --- /dev/null +++ b/src/util/paths.conf @@ -0,0 +1,29 @@ +# This file is in the public domain. +# +[PATHS] +# The PATHS section is special, as filenames including $-expression are +# expanded using the values from PATHS or the system environment (PATHS +# is checked first). Taler also supports expanding $-expressions using +# defaults with the syntax "${VAR:-default}". Here, "default" can again +# be a $-expression. +# +# We usually want $HOME for $TALER_HOME, but we allow testcases to +# easily override this by setting $TALER_TEST_HOME. +# +TALER_HOME = ${TALER_TEST_HOME:-${HOME:-${USERPROFILE}}} + +# see XDG Base Directory Specification at +# http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html +# for how these should be used. + +# Persistant data storage +TALER_DATA_HOME = ${XDG_DATA_HOME:-$TALER_HOME/.local/share}/taler/ + +# Configuration files +TALER_CONFIG_HOME = ${XDG_CONFIG_HOME:-$TALER_HOME/.config}/taler/ + +# Cached data, no big deal if lost +TALER_CACHE_HOME = ${XDG_CACHE_HOME:-$TALER_HOME/.cache}/taler/ + +# Runtime data (always lost on system boot) +TALER_RUNTIME_DIR = ${TMPDIR:-${TMP:-/tmp}}/taler-system-runtime/ diff --git a/src/util/util.c b/src/util/util.c index 434ce8a9d..d5fa8c05c 100644 --- a/src/util/util.c +++ b/src/util/util.c @@ -89,31 +89,4 @@ TALER_config_get_denom (struct GNUNET_CONFIGURATION_Handle *cfg, } -/** - * Load configuration by parsing all configuration - * files in the given directory. - * - * @param base_dir directory with the configuration files - * @return NULL on error, otherwise configuration - */ -struct GNUNET_CONFIGURATION_Handle * -TALER_config_load (const char *base_dir) -{ - struct GNUNET_CONFIGURATION_Handle *cfg; - char *cfg_dir; - int res; - - res = GNUNET_asprintf (&cfg_dir, - "%s" DIR_SEPARATOR_STR "config", - base_dir); - GNUNET_assert (res > 0); - cfg = GNUNET_CONFIGURATION_create (); - res = GNUNET_CONFIGURATION_load_from (cfg, cfg_dir); - GNUNET_free (cfg_dir); - if (GNUNET_OK != res) - return NULL; - return cfg; -} - - /* end of util.c */ -- cgit v1.2.3