protected function makeDirectory($path, $baseDir = null)
    {
        if (is_dir($path) === true) {
            return;
        }

        if ($this->chmod === null) {
            $chmod = 0777;
        } else {
            $chmod = $this->chmod;
        }

        $retries = 3;
        while ($retries --) {
            @mkdir($path, $chmod, true);
            if (is_dir($path)) {
                break;
            }
            usleep(20);
        }

        // enforce the correct mode for all directories created
        if (strpos(PHP_OS, 'WIN') !== 0 && $baseDir !== null) {
            $path    = strtr(str_replace($baseDir, '', $path), '\\', '/');
            $folders = explode('/', trim($path, '/'));
            foreach ($folders as $folder) {
                $baseDir .= $folder . DIRECTORY_SEPARATOR;
                if (!chmod($baseDir, $chmod)) {
                    throw new Exception('Unable to chmod ' . "$baseDir to $chmod: " . print_r(error_get_last(), true));
                }
            }
        }
    }
protected function makeDirectory($path, $baseDir = null)
    {
        if (is_dir($path) === true) {
            return;
        }

        if ($this->chmod === null) {
            $chmod = 0777;
        } else {
            $chmod = $this->chmod;
        }

        $retries = 3;
        while ($retries --) {
            @mkdir($path, $chmod, true);
            if (is_dir($path)) {
                break;
            }
            usleep(20);
        }

        // enforce the correct mode for all directories created
        if (strpos(PHP_OS, 'WIN') !== 0 && $baseDir !== null) {
            $path    = strtr(str_replace($baseDir, '', $path), '\\', '/');
            $folders = explode('/', trim($path, '/'));
            foreach ($folders as $folder) {
                $baseDir .= $folder . DIRECTORY_SEPARATOR;
                if (!chmod($baseDir, $chmod)) {
                    throw new Exception('Unable to chmod ' . "$baseDir to $chmod: " . print_r(error_get_last(), true));
                }
            }
        }
    }
protected function makeDirectory ( $ path , $ baseDir = null ) { if ( is_dir ( $ path ) === true ) { return ; } if ( $ this -> chmod === null ) { $ chmod = 0777 ; } else { $ chmod = $ this -> chmod ; } $ retries = 3 ; while ( $ retries -- ) { @ mkdir ( $ path , $ chmod , true ) ; if ( is_dir ( $ path ) ) { break ; } usleep ( 20 ) ; } // enforce the correct mode for all directories created if ( strpos ( PHP_OS , 'WIN' ) !== 0 && $ baseDir !== null ) { $ path = strtr ( str_replace ( $ baseDir , '' , $ path ) , '\\' , '/' ) ; $ folders = explode ( '/' , trim ( $ path , '/' ) ) ; foreach ( $ folders as $ folder ) { $ baseDir .= $ folder . DIRECTORY_SEPARATOR ; if ( ! chmod ( $ baseDir , $ chmod ) ) { throw new Exception ( 'Unable to chmod ' . "$baseDir to $chmod: " . print_r ( error_get_last ( ) , true ) ) ; } } } }
Ensures the given path exists.

@param string $path    any path
@param string $baseDir the base directory where the directory is created
($path must still contain the full path, $baseDir
is only used for unix permissions)

@throws Exception
Ensures the given path exists .