Skip to content

Commit

Permalink
Clean up release file browser a little bit. Trailing slash on Main::c…
Browse files Browse the repository at this point in the history
…hannel_path is now optional.
  • Loading branch information
Michael Gauthier committed Jul 5, 2010
1 parent 59069bb commit 7fa8ed4
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/SimpleChannelFrontend/ReleaseFileBrowser.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

namespace PEAR2\SimpleChannelFrontend;

class ReleaseFileBrowser
{
public $options;
Expand All @@ -8,12 +10,14 @@ class ReleaseFileBrowser

public $internal_file;

function __construct($options = array())
public function __construct($options = array())
{
$file = Main::$channel_path.'/get/'.$options['release'];
if (!file_exists($file)
|| dirname($file) != Main::$channel_path.'/get') {
throw new \Exception('Cannot find the package. '.$file);
$root = rtrim(Main::$channel_path, DIRECTORY_SEPARATOR);
$root = $root . DIRECTORY_SEPARATOR . 'get';
$file = $root . DIRECTORY_SEPARATOR . $options['release'];

if (!file_exists($file) || dirname($file) != $root) {
throw new \Exception('Cannot find the package ' . $file . '.');
}

$this->release = new \PharData($file);
Expand All @@ -29,4 +33,4 @@ function __construct($options = array())

}

}
}

0 comments on commit 7fa8ed4

Please sign in to comment.