From a12ea4bb3b263885849b855d6276c77e265845ec Mon Sep 17 00:00:00 2001
From: "Edward Z. Yang" <edwardzyang@thewritingpot.com>
Date: Tue, 31 Jul 2007 02:04:32 +0000
Subject: [PATCH] [2.1.0] Fix bug in mkdir_deep that would prevent absolute
 paths in Unix systems from being created properly

git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@1321 48356398-32a2-884e-a903-53898d9a118a
---
 maintenance/merge-library.php | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/maintenance/merge-library.php b/maintenance/merge-library.php
index 903da869..d1ba92bd 100644
--- a/maintenance/merge-library.php
+++ b/maintenance/merge-library.php
@@ -53,7 +53,13 @@ function mkdir_deep($folder) {
     $folders = preg_split("#[\\\\/]#", $folder);
     $base = '';
     for($i = 0, $c = count($folders); $i < $c; $i++) {
-        if(empty($folders[$i])) continue;
+        if(empty($folders[$i])) {
+            if (!$i) {
+                // special case for root level
+                $base .= DIRECTORY_SEPARATOR;
+            }
+            continue;
+        }
         $base .= $folders[$i];
         if(!is_dir($base)){
             mkdir($base);