From: mishas Date: Wed, 5 Sep 2007 14:36:39 +0000 (+0000) Subject: do not use hard-coded configuration file name; use g_get_home_dir instead X-Git-Url: http://git.maemo.org/git/?a=commitdiff_plain;h=f58f1917c4cf6e33ca9104e605ad2e8d8d2eacab;p=simple-launcher 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 --- 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];