From e094d7d2ddb28630148d8dc32e8fe8b191e2d7d5 Mon Sep 17 00:00:00 2001 From: "John P. Neumann" Date: Wed, 27 Jun 2018 19:23:04 -0500 Subject: [PATCH] resolves #77 - fixes the ternary operator to set the correct autoloadPath --- bin/md2resume | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/bin/md2resume b/bin/md2resume index 200752e..3ab43a6 100755 --- a/bin/md2resume +++ b/bin/md2resume @@ -7,12 +7,10 @@ $cwd = getcwd(); $templatePath = $baseDir . '/templates'; $consoleTemplatePath = $baseDir . '/src/Resume/Templates'; -// When md2resume is installed with composer, it resides in the a -// 'markdown-resume' subdirectory of the 'vendor' directory, so we need to -// walk up a few folders to find 'autoload.php'. -$autoloadPath = basename($baseDir) === 'markdown-resume' - ? realpath($baseDir . '/../../autoload.php') - : $baseDir . '/vendor/autoload.php'; +// When md2resume is used as a dependency with composer, it resides in the +// 'vendor/markdown-resume' directory. This means that the 'autoload.php' is +// actually much higher in the directory tree than is normally expected. +$autoloadPath = (strpos($baseDir, 'vendor')) ? realpath($baseDir . '/../../autoload.php') : $baseDir . '/vendor/autoload.php'; // If the dependencies aren't installed, we have to bail and offer some help. if (!file_exists($autoloadPath)) {