views:

7

answers:

1

Hi,

Is there a cross-platform compliant way of finding out the path to the main executables of OpenSSL and GnuPG? Obviously this would be null if the software was not installed or detected.

+1  A: 

You can explode $_ENV['PATH'] by PATH_SEPARATOR and look for either openssl or openssl.exe (on Windows) in each of the paths (analogous for GunPG).

Artefacto
You mean explode by ; and not the PATH_SEPARATOR? My Windows install has OpenSSL installed as well as GnuPG, but I do not see a single path in the `$_ENV['PATH']` that would reveal it.
rFactor
No, I mean what I said. `PATH_SEPARATOR` is `;` on Windows, but `:` on other platforms.
Artefacto
@rFactor If you don't see any path on the env variable that would reveal it, then all you can do is to scan the filesystem...
Artefacto