summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Caujolle-Bert <f1rmb@users.sourceforge.net>2001-12-10 01:43:30 +0000
committerDaniel Caujolle-Bert <f1rmb@users.sourceforge.net>2001-12-10 01:43:30 +0000
commit39f0ae3769da1bcd0b2e1999e2b11b8fad16952b (patch)
tree03a3574219e406818dd0a6fc7143bb1f76cad969
parent40ba21291707691b0fd056c578b0e7b7f4a271a0 (diff)
downloadxine-lib-39f0ae3769da1bcd0b2e1999e2b11b8fad16952b.tar.gz
xine-lib-39f0ae3769da1bcd0b2e1999e2b11b8fad16952b.tar.bz2
create directory recusively.
CVS patchset: 1206 CVS date: 2001/12/10 01:43:30
-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);