Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

finding path variables on different operating systems #8

Merged
merged 1 commit into from

2 participants

@lornajane

and adding directory separators so that the complete paths are correct (it doesn't matter if there are two path separators together, I believe all platforms will handle this correctly)

@lornajane lornajane finding path variables on different operating systems and adding dire…
…ctory separators so that the complete paths are correct
b78491d
@mgatto mgatto merged commit 339461c into lisantra-technologies:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 16, 2013
  1. @lornajane

    finding path variables on different operating systems and adding dire…

    lornajane authored
    …ctory separators so that the complete paths are correct
This page is out of date. Refresh to see the latest.
Showing with 7 additions and 6 deletions.
  1. +7 −6 src/VersionControl/Hg/Executable.php
View
13 src/VersionControl/Hg/Executable.php
@@ -220,11 +220,14 @@ public function setExecutable($path = null)
{
$executables = array();
- /* Set the binary name per platform */
+ /* Set the binary name and paths per platform */
if(substr(strtolower(PHP_OS), 0, 3) == "win") {
$binary = 'hg.exe';
+ $env_paths = explode(PATH_SEPARATOR, $_SERVER['Path']);
} else {
$binary = 'hg';
+ $env_paths = explode(PATH_SEPARATOR, $_SERVER['PATH']);
+
}
/* use the user provided path to an executable */
@@ -240,11 +243,9 @@ public function setExecutable($path = null)
if ( ( empty($executables) ) || ( null === $path ) ) {
/* iterate through the system's path to automagically find an
* executable */
- $paths = explode(PATH_SEPARATOR, $_SERVER['Path']);
-
- foreach ( $paths as $path ) {
- if (is_executable($path . $binary)) { //DIRECTORY_SEPARATOR .
- $executables[] = $path . $binary;
+ foreach ( $env_paths as $path ) {
+ if (is_executable($path . DIRECTORY_SEPARATOR . $binary)) {
+ $executables[] = $path . DIRECTORY_SEPARATOR . $binary;
}
}
Something went wrong with that request. Please try again.