diff src/xs_config.c @ 50:dae6d3c2268d

Minor fixes, updated to support default XMMS configfile
author Matti Hamalainen <ccr@tnsp.org>
date Sat, 21 Jun 2003 21:11:02 +0000
parents 84214a409d19
children 85811bcd049e
line wrap: on
line diff
--- a/src/xs_config.c	Sat Jun 21 20:51:01 2003 +0000
+++ b/src/xs_config.c	Sat Jun 21 21:11:02 2003 +0000
@@ -139,10 +139,14 @@
 
  /* Try to open the XMMS configuration file */
  XSDEBUG("loading from config-file ...\n");
-
+#ifdef HAVE_NODEFAULTCFG
  cfgFilename = g_strconcat(g_get_home_dir(), XS_CONFIG_FILE, NULL);
  cfgFile = xmms_cfg_open_file(cfgFilename);
  g_free(cfgFilename);
+#else
+ cfgFile = xmms_cfg_open_default_file();
+#endif
+
  if (cfgFile == NULL)
 	{
 	XSDEBUG("could not open configuration file, trying to write defaults...\n");
@@ -150,7 +154,6 @@
 	return;
 	}
 
-
  /* Read the new settings from XMMS configuration file */
  for (i = 0; i < XS_CFGTABLE_MAX; i++)
  	{
@@ -205,8 +208,12 @@
  /*
   * Try to open the XMMS configuration file
   */
+#ifdef HAVE_NODEFAULTCFG
  cfgFilename = g_strconcat(g_get_home_dir(), XS_CONFIG_FILE, NULL);
  cfgFile = xmms_cfg_open_file(cfgFilename);
+#else
+ cfgFile = xmms_cfg_open_default_file();
+#endif
 
  if (!cfgFile)
 	cfgFile = xmms_cfg_new();
@@ -239,11 +246,15 @@
 	}
 
  /* Flush the file */
+#ifdef HAVE_NODEFAULTCFG
  xmms_cfg_write_file(cfgFile, cfgFilename);
+ g_free(cfgFilename);
+#else
+ xmms_cfg_write_default_file(cfgFile);
+#endif
 
  /* Free the memory areas */
  xmms_cfg_free(cfgFile);
- g_free(cfgFilename);
 
  return 0;
 }