Skip to content

Commit aa1f7ac

Browse files
committed
Add support for php.new (herd-lite)
1 parent cf62cbd commit aa1f7ac

File tree

2 files changed

+15
-8
lines changed

2 files changed

+15
-8
lines changed

discovery.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,15 @@ import (
3636

3737
// discover tries to find all PHP versions on the current machine
3838
func (s *PHPStore) discover() {
39+
userHomeDir := userHomeDir()
40+
3941
s.doDiscover()
4042

43+
if userHomeDir != "" {
44+
// Herd-lite
45+
s.addFromDir(filepath.Join(userHomeDir, ".config", "herd-lite", "bin"), nil, "php.new (Herd-lite)")
46+
}
47+
4148
// Under $PATH
4249
paths := s.pathDirectories(s.configDir)
4350
s.log("Looking for PHP in the PATH (%s)", paths)
@@ -350,3 +357,11 @@ func (s *PHPStore) pathDirectories(configDir string) []string {
350357
}
351358
return dirs
352359
}
360+
361+
func userHomeDir() string {
362+
userHomeDir, err := os.UserHomeDir()
363+
if err != nil {
364+
return ""
365+
}
366+
return userHomeDir
367+
}

discovery_windows.go

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,3 @@ func systemDir() string {
6060
}
6161
return filepath.VolumeName(cwd) + "\\"
6262
}
63-
64-
func userHomeDir() string {
65-
userHomeDir, err := os.UserHomeDir()
66-
if err != nil {
67-
return ""
68-
}
69-
return userHomeDir
70-
}

0 commit comments

Comments
 (0)