/* * call-seq: * Xmms.userconfdir -> String * * Returns the xmms2 configuration directory for the current user. */ static VALUE m_userconfdir_get (VALUE self) { const char *p; char path[XMMS_PATH_MAX]; p = xmmsc_userconfdir_get (path, XMMS_PATH_MAX); return p ? rb_str_new2 (p) : Qnil; }
gchar * configuration_get_filename (void) { gchar *filename, *dir; dir = g_new0 (gchar, XMMS_PATH_MAX); xmmsc_userconfdir_get (dir, XMMS_PATH_MAX); filename = g_build_path (G_DIR_SEPARATOR_S, dir, "clients", "nycli.conf", NULL); g_free (dir); return filename; }
configuration_t * configuration_init (const gchar *path) { configuration_t *config; gchar *history_file; config = g_new0 (configuration_t, 1); if (path == NULL) { char *dir; dir = g_new0 (char, XMMS_PATH_MAX); xmmsc_userconfdir_get (dir, XMMS_PATH_MAX); config->path = g_strdup_printf ("%s/clients/nycli.conf", dir); g_free (dir); } else {
char* get_config_filename(const char* filename) { char config_dir[XMMS_PATH_MAX] = {'\0'}; char *config_file = NULL; int path_len, filename_len; if (! filename) return NULL; if (xmmsc_userconfdir_get (config_dir, XMMS_PATH_MAX)) { path_len = strlen (config_dir); filename_len = strlen (filename); config_file = (char*) malloc (sizeof(char) * (path_len + filename_len + 17)); if (config_file) { strcpy (config_file, config_dir); strcat (config_file, "/clients/rockon/"); strcat (config_file, filename); return config_file; } } return NULL; }