do not use hard-coded configuration file name; use g_get_home_dir instead
authormishas <mikhail.sobolev@gmail.com>
Wed, 5 Sep 2007 14:36:39 +0000 (14:36 +0000)
committermishas <mikhail.sobolev@gmail.com>
Wed, 5 Sep 2007 14:36:39 +0000 (14:36 +0000)
git-svn-id: file:///svnroot/simple-launcher/trunk@216 3ba93dab-e023-0410-b42a-de7732cf370a

simple-launcher.cc

index 9232b0a..e28345d 100644 (file)
@@ -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];