@@ -28,7 +28,7 @@ import (
2828// see https://github.com/composer/windows-setup/blob/master/src/composer.iss
2929func (s * PHPStore ) doDiscover () {
3030 systemDir := systemDir ()
31- userProfileDir := userProfileDir ()
31+ userHomeDir := userHomeDir ()
3232
3333 // XAMPP
3434 s .addFromDir (filepath .Join (systemDir , "xampp" , "php" ), nil , "XAMPP" )
@@ -48,8 +48,8 @@ func (s *PHPStore) doDiscover() {
4848 s .discoverFromDir (filepath .Join (systemDir , "mamp" , "bin" , "php" ), nil , regexp .MustCompile ("^php[\\ d\\ .]+$" ), "MAMP" )
4949
5050 // 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" )
5353 }
5454}
5555
@@ -61,6 +61,10 @@ func systemDir() string {
6161 return filepath .VolumeName (cwd ) + "\\ "
6262}
6363
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
6670}
0 commit comments