Skip to content

Commit

Permalink
Merge pull request pear#11 from alecpl/fix_20527
Browse files Browse the repository at this point in the history
Fix path to pinentry-cli.xml file on composer installs (Bug #20527)
  • Loading branch information
gauthierm committed Aug 18, 2015
2 parents 39ee090 + e5be21c commit 7da2570
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions Crypt/GPG/PinEntry.php
Expand Up @@ -320,11 +320,18 @@ protected function getUIXML()
$dir = '@data-dir@' . DIRECTORY_SEPARATOR
. '@package-name@' . DIRECTORY_SEPARATOR . 'data';

// Check if we're running directly from a git checkout or if we're
// running from a PEAR-packaged version.
if ($dir[0] == '@') {
// Check if we're running from a PEAR-packaged version
// or directly from a git checkout or other installation
// that does not resolve PEAR variables
if (strpos($dir, '@') !== false) {
$dir = dirname(__FILE__) . DIRECTORY_SEPARATOR . '..'
. DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'data';

// Workaround for composer installs (#20527)
$composerDir = $dir . DIRECTORY_SEPARATOR . 'Crypt_GPG' . DIRECTORY_SEPARATOR . 'data';
if (is_dir($composerDir)) {
$dir = $composerDir;
}
}

return $dir . DIRECTORY_SEPARATOR . 'pinentry-cli.xml';
Expand Down

0 comments on commit 7da2570

Please sign in to comment.