1
0
Fork 0

Support windows local paths

pull/498/head
Jordi Boggiano 2012-03-24 23:19:11 +01:00
parent 862d4af274
commit 30d4080014
1 changed files with 7 additions and 4 deletions

View File

@ -14,6 +14,7 @@ namespace Composer\Repository\Vcs;
use Composer\Json\JsonFile; use Composer\Json\JsonFile;
use Composer\Util\ProcessExecutor; use Composer\Util\ProcessExecutor;
use Composer\Util\Filesystem;
use Composer\Util\Svn as SvnUtil; use Composer\Util\Svn as SvnUtil;
use Composer\IO\IOInterface; use Composer\IO\IOInterface;
@ -64,7 +65,7 @@ class SvnDriver extends VcsDriver
*/ */
public function __construct($url, IOInterface $io, ProcessExecutor $process = null) public function __construct($url, IOInterface $io, ProcessExecutor $process = null)
{ {
$url = self::fixSvnUrl($url); $url = self::normalizeUrl($url);
parent::__construct($this->baseUrl = rtrim($url, '/'), $io, $process); parent::__construct($this->baseUrl = rtrim($url, '/'), $io, $process);
if (false !== ($pos = strrpos($url, '/trunk'))) { if (false !== ($pos = strrpos($url, '/trunk'))) {
@ -298,11 +299,13 @@ class SvnDriver extends VcsDriver
* *
* @return string * @return string
*/ */
protected static function fixSvnUrl($url) protected static function normalizeUrl($url)
{ {
if (strpos($url, '/', 0) === 0) { $fs = new Filesystem();
$url = 'file://' . $url; if ($fs->isAbsolutePath($url)) {
return 'file://' . strtr($url, '\\', '/');
} }
return $url; return $url;
} }
} }