- for (it = xdg_config_dir_paths; !r && it; it = g_slist_next(it)) {
- path = g_build_filename(it->data, "openbox", "rc.xml", NULL);
- r = parse_load(path, "openbox_config", doc, root);
- g_free(path);
+ *fileused = NULL;
+
+ if (file) {
+ if ((r = parse_load(file, "openbox_config", doc, root)))
+ *fileused = g_strdup(file);
+ } else {
+ /* this won't run if the above code loaded a config */
+ for (it = xdg_config_dir_paths; !r && it; it = g_slist_next(it)) {
+ gchar *path;
+
+ path = g_build_filename(it->data, "openbox", "rc.xml", NULL);
+ if ((r = parse_load(path, "openbox_config", doc, root)))
+ *fileused = path;
+ else
+ g_free(path);
+ }