mirror of
https://github.com/there4/markdown-resume.git
synced 2024-12-03 08:59:35 -05:00
Change template list to DirectoryIterator. Closes #24
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.
This commit is contained in:
@@ -18,11 +18,16 @@ class TemplatesCommand extends Command
|
|||||||
{
|
{
|
||||||
$this->app = $this->getApplication();
|
$this->app = $this->getApplication();
|
||||||
$tplData = array('templates' => array());
|
$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(
|
$tplData['templates'][] = (object) array(
|
||||||
'name' => basename($dir),
|
'name' => $fileInfo->getBasename(),
|
||||||
'description' => file_exists($dir . '/description.txt')
|
'description' => file_exists($descriptionPath)
|
||||||
? trim(file_get_contents($dir . '/description.txt'))
|
? trim(file_get_contents($descriptionPath))
|
||||||
: 'No description available'
|
: 'No description available'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user