summaryrefslogtreecommitdiff
path: root/shared/config-parser.c
diff options
context:
space:
mode:
authorPekka Paalanen <pekka.paalanen@collabora.co.uk>2015-03-24 15:56:19 +0200
committerPekka Paalanen <pekka.paalanen@collabora.co.uk>2015-03-27 09:38:12 +0200
commit6c71aaeec5d034e052c9d95f3c36b5b38069f6d8 (patch)
tree6a5d8b4cebb294d03b583e891553c5fcffc26cff /shared/config-parser.c
parentdc940caae54ee8a631a30d76b54b209dab322d12 (diff)
Pass config file from compositor to everything
We have the Weston command line option '--no-config' which is meant to prevent loading weston.ini at all. It works for Weston itself, but it does not work for any clients that also want to read weston.ini. To fix that, introduce a new environment variable WESTON_CONFIG_FILE. Weston will set it to the absolute path of the config file it loads. Clients will load the config file pointed to by WESTON_CONFIG_FILE. If the environment variable is set but empty, no config file will be loaded. If the variable is unset, things fall back to the default "weston.ini". Note, that Weston will only set WESTON_CONFIG_FILE, it never reads it. The ability to specify a custom config file to load will be another patch. All programs that loaded "weston.ini" are modified to honour WESTON_CONFIG_FILE. Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk> Reviewed-by: Jonny Lamb <jonny.lamb@collabora.co.uk> Reviewed-by: Nobuhiko Tanibata <NOBUHIKO_TANIBATA@xddp.denso.co.jp> Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
Diffstat (limited to 'shared/config-parser.c')
-rw-r--r--shared/config-parser.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/shared/config-parser.c b/shared/config-parser.c
index ff6814ce..8519eb68 100644
--- a/shared/config-parser.c
+++ b/shared/config-parser.c
@@ -294,6 +294,18 @@ weston_config_get_libexec_dir(void)
return LIBEXECDIR;
}
+const char *
+weston_config_get_name_from_env(void)
+{
+ const char *name;
+
+ name = getenv(WESTON_CONFIG_FILE_ENV_VAR);
+ if (name)
+ return name;
+
+ return "weston.ini";
+}
+
static struct weston_config_section *
config_add_section(struct weston_config *config, const char *name)
{