Added support for spaces in path names (thanks Greg!)

This commit is contained in:
Tomas V.V.Cox 2003-08-03 19:32:07 +00:00
parent ea12731b4e
commit 7d67054891
5 changed files with 17 additions and 15 deletions

View File

@ -156,7 +156,7 @@ class PEAR_Common extends PEAR
$tempfiles =& $GLOBALS['_PEAR_Common_tempfiles'];
while ($file = array_shift($tempfiles)) {
if (@is_dir($file)) {
System::rm("-rf $file");
System::rm(array('-rf', $file));
} elseif (file_exists($file)) {
unlink($file);
}
@ -198,7 +198,7 @@ class PEAR_Common extends PEAR
function mkDirHier($dir)
{
$this->log(2, "+ create dir $dir");
return System::mkDir("-p $dir");
return System::mkDir(array('-p', $dir));
}
// }}}
@ -242,11 +242,12 @@ class PEAR_Common extends PEAR
function mkTempDir($tmpdir = '')
{
if ($tmpdir) {
$topt = "-t $tmpdir ";
$topt = array('-t', $tmpdir);
} else {
$topt = '';
$topt = array();
}
if (!$tmpdir = System::mktemp($topt . '-d pear')) {
$topt = array_merge($topt, array('-d', 'pear'));
if (!$tmpdir = System::mktemp($topt)) {
return false;
}
$this->addTempFile($tmpdir);
@ -1155,7 +1156,7 @@ class PEAR_Common extends PEAR
* Build a "provides" array from data returned by
* analyzeSourceCode(). The format of the built array is like
* this:
*
*
* array(
* 'class;MyClass' => 'array('type' => 'class', 'name' => 'MyClass'),
* ...
@ -1168,7 +1169,7 @@ class PEAR_Common extends PEAR
* @return void
*
* @access public
*
*
*/
function buildProvidesArray($srcinfo)
{
@ -1597,7 +1598,7 @@ class PEAR_Common extends PEAR
$errno, $errstr));
}
return PEAR::raiseError("Connection to `$host:$port' failed: $errstr", $errno);
}
}
$request = "GET $path HTTP/1.0\r\n";
}
$request .= "Host: $host:$port\r\n".

View File

@ -577,7 +577,8 @@ class PEAR_Config extends PEAR
}
$data = ($data === null) ? $this->configuration[$layer] : $data;
$this->_encodeOutput($data);
if (!@System::mkDir("-p " . dirname($file))) {
$opt = array('-p', dirname($file));
if (!@System::mkDir($opt)) {
return $this->raiseError("could not create directory: " . dirname($file));
}
if (@is_file($file) && !@is_writeable($file)) {

View File

@ -116,7 +116,7 @@ class PEAR_Packager extends PEAR_Common
chdir($oldcwd);
return $this->raiseError($new_xml);
}
if (!($tmpdir = System::mktemp('-t '.getcwd().' -d'))) {
if (!($tmpdir = System::mktemp(array('-t', getcwd(), '-d')))) {
chdir($oldcwd);
return $this->raiseError("PEAR_Packager: mktemp failed");
}
@ -135,7 +135,7 @@ class PEAR_Packager extends PEAR_Common
$tar =& new Archive_Tar($dest_package, $compress);
$tar->setErrorHandling(PEAR_ERROR_RETURN); // XXX Don't print errors
// ----- Creates with the package.xml file
$ok = $tar->createModify($newpkgfile, '', $tmpdir);
$ok = $tar->createModify(array($newpkgfile), '', $tmpdir);
if (PEAR::isError($ok)) {
chdir($oldcwd);
return $this->raiseError($ok);

View File

@ -146,7 +146,7 @@ class PEAR_Registry extends PEAR
function _assertStateDir()
{
if (!@is_dir($this->statedir)) {
if (!System::mkdir("-p {$this->statedir}")) {
if (!System::mkdir(array('-p', $this->statedir))) {
return $this->raiseError("could not create directory '{$this->statedir}'");
}
}

View File

@ -56,14 +56,14 @@ class PEAR_Remote extends PEAR
$id = md5(serialize($args));
$cachedir = $this->config->get('cache_dir');
if (!file_exists($cachedir)) {
System::mkdir('-p '.$cachedir);
System::mkdir(array('-p', $cachedir));
}
$filename = $cachedir . DIRECTORY_SEPARATOR . 'xmlrpc_cache_' . $id;
if (!file_exists($filename)) {
return null;
};
$fp = fopen($filename, "rb");
$fp = fopen($filename, 'rb');
if ($fp === null) {
return null;
}
@ -86,7 +86,7 @@ class PEAR_Remote extends PEAR
$id = md5(serialize($args));
$cachedir = $this->config->get('cache_dir');
if (!file_exists($cachedir)) {
System::mkdir('-p '.$cachedir);
System::mkdir(array('-p', $cachedir));
}
$filename = $cachedir.'/xmlrpc_cache_'.$id;