This question surprised me a bit - but I have no clue about where to locate my extension directory!!
Is there a simple way to reliably locate it (either programatically or via the UI)?
You can find your extension directory by going to Administer menu » System Settings » Directories and checking the value for the "Extensions" directory. If there's a token like [civicrm.root], you can determine its value with this technique.
In PHP it looks like this is what I need:
return (new CRM_Extension_System())->getDefaultContainer()->baseDir;
So in bash
I can use cv
:
cv ev 'return (new CRM_Extension_System())->getDefaultContainer()->baseDir'
or better still, as pointed out be Tim:
cv ev 'return CRM_Core_Config::singleton()->extensionsDir'
which means this one liner will take you to the directory:
cd `cv ev 'return CRM_Core_Config::singleton()->extensionsDir;' --out=pretty`
CRM_Core_Config::singleton()->extensionsDir;
. (2) Coincidentally, I've been mulling a form of this problem in github.com/civicrm/cv/pull/14
Commented
Jan 23, 2017 at 20:03