From f58f1917c4cf6e33ca9104e605ad2e8d8d2eacab Mon Sep 17 00:00:00 2001 From: mishas Date: Wed, 5 Sep 2007 14:36:39 +0000 Subject: [PATCH] do not use hard-coded configuration file name; use g_get_home_dir instead git-svn-id: file:///svnroot/simple-launcher/trunk@216 3ba93dab-e023-0410-b42a-de7732cf370a --- simple-launcher.cc | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/simple-launcher.cc b/simple-launcher.cc index 9232b0a..e28345d 100644 --- a/simple-launcher.cc +++ b/simple-launcher.cc @@ -184,11 +184,18 @@ void SimpleLauncherApplet::addItem(LauncherItems& items, const std::string& name } } -// FIXME: this probably should be done somehow differently -static char *configFileName="/home/user/.slarc"; +static const gchar *getConfigFileName() { + static gchar *configFileName = NULL; + + if (configFileName == NULL) { + configFileName = g_build_filename(g_get_home_dir(), ".slarc", NULL); + } + + return configFileName; +} void SimpleLauncherApplet::loadConfig() { - std::ifstream config(configFileName); + std::ifstream config(getConfigFileName()); if (config) { char *buffer = new char [1024]; -- 1.7.9.5