summaryrefslogtreecommitdiff
path: root/src/input
diff options
context:
space:
mode:
Diffstat (limited to 'src/input')
-rw-r--r--src/input/input_cda.c28
1 files changed, 26 insertions, 2 deletions
diff --git a/src/input/input_cda.c b/src/input/input_cda.c
index 73ca031ac..d1acb9964 100644
--- a/src/input/input_cda.c
+++ b/src/input/input_cda.c
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: input_cda.c,v 1.6 2001/12/10 00:58:13 f1rmb Exp $
+ * $Id: input_cda.c,v 1.7 2001/12/10 01:43:30 f1rmb Exp $
*/
#ifdef HAVE_CONFIG_H
@@ -171,6 +171,30 @@ static void _cda_mkdir_safe(char *path) {
}
/*
+ *
+ */
+static void _cda_mkdir_recursive_safe(char *path) {
+ char *p, *pp;
+ char buf[PATH_MAX + NAME_MAX + 1];
+ char buf2[PATH_MAX + NAME_MAX + 1];
+
+ if(path == NULL)
+ return;
+
+ memset(&buf, 0, sizeof(buf));
+ memset(&buf2, 0, sizeof(buf2));
+
+ sprintf(buf, "%s", path);
+ pp = buf;
+ while((p = xine_strsep(&pp, "/")) != NULL) {
+ if(p && strlen(p)) {
+ sprintf(buf2, "%s/%s", buf2, p);
+ _cda_mkdir_safe(buf2);
+ }
+ }
+}
+
+/*
* Return user name.
*/
static char *_cda_get_username_safe(void) {
@@ -427,7 +451,7 @@ static void _cda_save_cached_cddb_infos(cda_input_plugin_t *this, char *filecont
/* Ensure "~/.xine/cddbcache" exist */
sprintf(cfile, "%s", this->cddb.cache_dir);
- _cda_mkdir_safe(cfile);
+ _cda_mkdir_recursive_safe(cfile);
sprintf(cfile, "%s/%08lx", this->cddb.cache_dir, this->cda->disc_id);