From 0c9543b04e6d932f85f0f509c4cd5b43bf60e3f1 Mon Sep 17 00:00:00 2001 From: Aleksandr Bogdanov Date: Sun, 15 Mar 2015 10:55:33 +0100 Subject: [PATCH] Checking if --template has a directory separator. Closes #7 --- src/Resume/Command/HtmlCommand.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/Resume/Command/HtmlCommand.php b/src/Resume/Command/HtmlCommand.php index 7af2d48..ca54bf1 100644 --- a/src/Resume/Command/HtmlCommand.php +++ b/src/Resume/Command/HtmlCommand.php @@ -35,7 +35,7 @@ class HtmlCommand extends Command 'template', 't', InputOption::VALUE_REQUIRED, - 'Which of the templates to use' + 'Which of the templates to use. Use an absolute path for a custom template.' ) ->addOption( 'refresh', @@ -126,7 +126,13 @@ class HtmlCommand extends Command if (!$template) { $template = $this->app->defaultTemplate; } - $templatePath = join(DIRECTORY_SEPARATOR, array($this->app->templatePath, basename($template))); + + if (strpos($template, DIRECTORY_SEPARATOR) !== false) { + $templatePath = realpath($template); + } else { + $templatePath = join(DIRECTORY_SEPARATOR, array($this->app->templatePath, basename($template))); + } + $templateIndexPath = join(DIRECTORY_SEPARATOR, array($templatePath, 'index.html')); if (!file_exists($templateIndexPath)) {