@@ -28,7 +28,7 @@ import (
28
28
// see https://github.com/composer/windows-setup/blob/master/src/composer.iss
29
29
func (s * PHPStore ) doDiscover () {
30
30
systemDir := systemDir ()
31
- userProfileDir := userProfileDir ()
31
+ userHomeDir := userHomeDir ()
32
32
33
33
// XAMPP
34
34
s .addFromDir (filepath .Join (systemDir , "xampp" , "php" ), nil , "XAMPP" )
@@ -48,8 +48,8 @@ func (s *PHPStore) doDiscover() {
48
48
s .discoverFromDir (filepath .Join (systemDir , "mamp" , "bin" , "php" ), nil , regexp .MustCompile ("^php[\\ d\\ .]+$" ), "MAMP" )
49
49
50
50
// Herd
51
- if userProfileDir != "" {
52
- s .discoverFromDir (filepath .Join (userProfileDir , ".config" , "herd" , "bin" ), nil , regexp .MustCompile ("^php\\ d{2}$" ), "Herd" )
51
+ if userHomeDir != "" {
52
+ s .discoverFromDir (filepath .Join (userHomeDir , ".config" , "herd" , "bin" ), nil , regexp .MustCompile ("^php\\ d{2}$" ), "Herd" )
53
53
}
54
54
}
55
55
@@ -61,6 +61,10 @@ func systemDir() string {
61
61
return filepath .VolumeName (cwd ) + "\\ "
62
62
}
63
63
64
- func userProfileDir () string {
65
- return os .Getenv ("USERPROFILE" )
64
+ func userHomeDir () string {
65
+ userHomeDir , err := os .UserHomeDir ()
66
+ if err != nil {
67
+ return ""
68
+ }
69
+ return userHomeDir
66
70
}
0 commit comments