File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed
Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -37,25 +37,31 @@ type environmentInfo interface {
3737
3838type environment struct {
3939 args * args
40+ cwd string
4041}
4142
4243func (env * environment ) getenv (key string ) string {
4344 return os .Getenv (key )
4445}
4546
4647func (env * environment ) getcwd () string {
48+ if env .cwd != "" {
49+ return env .cwd
50+ }
4751 correctPath := func (pwd string ) string {
4852 // on Windows, and being case sentisitive and not consistent and all, this gives silly issues
4953 return strings .Replace (pwd , "c:" , "C:" , 1 )
5054 }
5155 if env .args != nil && * env .args .PWD != "" {
52- return correctPath (* env .args .PWD )
56+ env .cwd = correctPath (* env .args .PWD )
57+ return env .cwd
5358 }
5459 dir , err := os .Getwd ()
5560 if err != nil {
5661 return ""
5762 }
58- return correctPath (dir )
63+ env .cwd = correctPath (dir )
64+ return env .cwd
5965}
6066
6167func (env * environment ) homeDir () string {
You can’t perform that action at this time.
0 commit comments