Why strip drive letter in Pear package Installer in Windows?
| From: | Marcos Mezo | Date: | Tue, 08 Apr 2003 18:50:12 +0000 |
| Subject: | Why strip drive letter in Pear package Installer in Windows? | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-4716@lists.php.net to get a copy of this message | ||
I recently upgraded to PHP 4.3.1 at work (WinNT 4 + IIS 4, PHP as CGI) and I wanted to have PEAR installed as I'm using various of it's classes.
After some thinking about and looking at code I finaly go Pear installed by using go-pear.php, and I let it install the base packages (DB,...) as suggested. Then I wanted to install more things and, though the (web) installer showed the available packages and seemed to work fine, as soon as I clicked a class for it to be installed I got an error window saying "failed to mkdir \php\PEAR\Auth". (Obviously I was installing the Auth package.)
Investigating a bit I found out that it was because in the _prependPath function in installer.php the drive letter was being stripped of if the OS turned out to be windows. I have my "document root" in drive D:, PHP in c:\php, and Pear in c:\php\PEAR.
I modified this file to leave the drive letter in and now it works fine. (Or at least it seems to).
This is how I left the aforementioned function:
function _prependPath($path, $prepend)
{
if (OS_WINDOWS && preg_match('/^[a-z]:/i', $path)) {
//$path = $prepend . substr($path, 2); <--- ¿Why this? -
$path = $prepend . $path;
} else {
$path = $prepend . $path;
}
return $path;
}
Is there any reason for stripping the drive letters?
Marcos Mezo