Skip to content

Commit

Permalink
Merge pull request #18 from chrisdeeming/patch-1
Browse files Browse the repository at this point in the history
Update Windows PHP discovery to look for PHP provided by Herd
  • Loading branch information
fabpot authored Apr 14, 2024
2 parents 3066752 + bbe8485 commit 8c75d8f
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions discovery_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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 {
Expand All @@ -54,3 +60,7 @@ func systemDir() string {
}
return filepath.VolumeName(cwd) + "\\"
}

func userProfileDir() string {
return os.Getenv("USERPROFILE")
}

0 comments on commit 8c75d8f

Please sign in to comment.