Skip to content

Commit

Permalink
Change template list to DirectoryIterator. Closes #24
Browse files Browse the repository at this point in the history
The glob directory iterator is not compatible with the phar file. The
DirectoryIterator appears to be able to handle it in both dev mode and
deployed phar.
  • Loading branch information
craig-davis committed Apr 28, 2014
1 parent cf50e58 commit 2c5d98f
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/Resume/Command/TemplatesCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,16 @@ protected function execute(InputInterface $input, OutputInterface $output)
{
$this->app = $this->getApplication();
$tplData = array('templates' => array());
foreach (glob($this->app->templatePath . '/*', GLOB_ONLYDIR) as $dir) {
foreach (new \DirectoryIterator($this->app->templatePath) as $fileInfo) {
if ($fileInfo->isDot() || !$fileInfo->isDir()) {
continue;
}
$descriptionPath = $fileInfo->getPathname() . '/description.txt';
print $descriptionPath . "\n";
$tplData['templates'][] = (object) array(
'name' => basename($dir),
'description' => file_exists($dir . '/description.txt')
? trim(file_get_contents($dir . '/description.txt'))
'name' => $fileInfo->getBasename(),
'description' => file_exists($descriptionPath)
? trim(file_get_contents($descriptionPath))
: 'No description available'
);
}
Expand Down

0 comments on commit 2c5d98f

Please sign in to comment.