From 1811ff52252da330f070815060e35b31c8446cc5 Mon Sep 17 00:00:00 2001 From: Ikey Doherty Date: Sun, 22 Oct 2017 00:03:51 +0100 Subject: [PATCH] lsi: Dedupe into common Signed-off-by: Ikey Doherty --- src/lsi/lsi.c | 34 ++-------------------------------- src/lsi/meson.build | 3 +++ 2 files changed, 5 insertions(+), 32 deletions(-) diff --git a/src/lsi/lsi.c b/src/lsi/lsi.c index b418865..3a1e2e7 100644 --- a/src/lsi/lsi.c +++ b/src/lsi/lsi.c @@ -26,6 +26,8 @@ #include "nica/hashmap.h" #include "nica/inifile.h" +#include "../common/files.h" + /** * Configuration file suffix, i.e. ~/.config/linux-steam-integration.conf */ @@ -42,38 +44,6 @@ */ #define LSI_VENDOR_CONFIG_FILE VENDORDIR "/ " LSI_CONFIG_FILE -/** - * Determine the home directory - */ -static const char *lsi_get_home_dir(void) -{ - char *c = NULL; - struct passwd *p = NULL; - - c = getenv("HOME"); - if (c) { - return c; - } - p = getpwuid(getuid()); - if (!p) { - return NULL; - } - return p->pw_dir; -} - -/** - * Determine the home config directory - */ -static char *lsi_get_user_config_dir(void) -{ - const char *home = lsi_get_home_dir(); - char *c = NULL; - if (asprintf(&c, "%s/.config", home) < 0) { - return NULL; - } - return c; -} - /** * Build the user config file path */ diff --git a/src/lsi/meson.build b/src/lsi/meson.build index 95f9995..13bd1fe 100644 --- a/src/lsi/meson.build +++ b/src/lsi/meson.build @@ -9,6 +9,9 @@ if shim_behaviour != 'none' or with_frontend == true lib_lsi = static_library( 'lsi-lsi', sources: lsi_sources + nica_sources, + dependencies: [ + link_lsi_common, + ], include_directories: nica_includes, ) link_lsi = declare_dependency(