Skip to content

Commit 8c75d8f

Browse files
authored
Merge pull request #18 from chrisdeeming/patch-1
Update Windows PHP discovery to look for PHP provided by Herd
2 parents 3066752 + bbe8485 commit 8c75d8f

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

discovery_windows.go

+10
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import (
2828
// see https://github.com/composer/windows-setup/blob/master/src/composer.iss
2929
func (s *PHPStore) doDiscover() {
3030
systemDir := systemDir()
31+
userProfileDir := userProfileDir()
3132

3233
// XAMPP
3334
s.addFromDir(filepath.Join(systemDir, "xampp", "php"), nil, "XAMPP")
@@ -45,6 +46,11 @@ func (s *PHPStore) doDiscover() {
4546

4647
// MAMP
4748
s.discoverFromDir(filepath.Join(systemDir, "mamp", "bin", "php"), nil, regexp.MustCompile("^php[\\d\\.]+$"), "MAMP")
49+
50+
// Herd
51+
if userProfileDir != "" {
52+
s.discoverFromDir(filepath.Join(userProfileDir, ".config", "herd", "bin"), nil, regexp.MustCompile("^php\\d{2}$"), "Herd")
53+
}
4854
}
4955

5056
func systemDir() string {
@@ -54,3 +60,7 @@ func systemDir() string {
5460
}
5561
return filepath.VolumeName(cwd) + "\\"
5662
}
63+
64+
func userProfileDir() string {
65+
return os.Getenv("USERPROFILE")
66+
}

0 commit comments

Comments
 (0)