From bbe84850bbdee5be99d2d7401b69ad36a8f97b9b Mon Sep 17 00:00:00 2001 From: Chris Deeming Date: Sun, 14 Apr 2024 05:14:09 +0100 Subject: [PATCH] Update Windows PHP discovery to look for PHP provided by Herd Closes #17 --- discovery_windows.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/discovery_windows.go b/discovery_windows.go index dfacd4a..d86173f 100644 --- a/discovery_windows.go +++ b/discovery_windows.go @@ -28,6 +28,7 @@ import ( // see https://github.com/composer/windows-setup/blob/master/src/composer.iss func (s *PHPStore) doDiscover() { systemDir := systemDir() + userProfileDir := userProfileDir() // XAMPP s.addFromDir(filepath.Join(systemDir, "xampp", "php"), nil, "XAMPP") @@ -45,6 +46,11 @@ func (s *PHPStore) doDiscover() { // MAMP s.discoverFromDir(filepath.Join(systemDir, "mamp", "bin", "php"), nil, regexp.MustCompile("^php[\\d\\.]+$"), "MAMP") + + // Herd + if userProfileDir != "" { + s.discoverFromDir(filepath.Join(userProfileDir, ".config", "herd", "bin"), nil, regexp.MustCompile("^php\\d{2}$"), "Herd") + } } func systemDir() string { @@ -54,3 +60,7 @@ func systemDir() string { } return filepath.VolumeName(cwd) + "\\" } + +func userProfileDir() string { + return os.Getenv("USERPROFILE") +}