From cb04f3585c1abe95f6bddfa282e829896c2bb19a Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Sat, 7 Dec 2024 16:50:26 -0600 Subject: debugging switching go/src dirs --- config.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'config.go') diff --git a/config.go b/config.go index 99ba64d..3f344e3 100644 --- a/config.go +++ b/config.go @@ -11,12 +11,12 @@ import ( "go.wit.com/log" ) -// write to ~/.config/forge/ unless ENV{FORGE_CONFIG} is set +// write to ~/.config/forge/ unless ENV{FORGE_GOSRC} is set func (all *Repos) ConfigSave() error { - if os.Getenv("FORGE_CONFIG") == "" { + if os.Getenv("FORGE_GOSRC") == "" { homeDir, _ := os.UserHomeDir() fullpath := filepath.Join(homeDir, ".config/forge") - os.Setenv("FORGE_CONFIG", fullpath) + os.Setenv("FORGE_GOSRC", fullpath) } if all == nil { log.Warn("gitpb all == nil") @@ -35,10 +35,10 @@ func (all *Repos) ConfigSave() error { // load the ~/.config/forge/ files func (all *Repos) ConfigLoad() error { - if os.Getenv("FORGE_CONFIG") == "" { + if os.Getenv("FORGE_GOSRC") == "" { homeDir, _ := os.UserHomeDir() fullpath := filepath.Join(homeDir, ".config/forge") - os.Setenv("FORGE_CONFIG", fullpath) + os.Setenv("FORGE_GOSRC", fullpath) } var data []byte var err error @@ -78,7 +78,7 @@ func (all *Repos) ConfigLoad() error { } func loadFile(filename string) ([]byte, error) { - fullname := filepath.Join(os.Getenv("FORGE_CONFIG"), filename) + fullname := filepath.Join(os.Getenv("FORGE_GOSRC"), filename) data, err := os.ReadFile(fullname) if errors.Is(err, os.ErrNotExist) { // if file does not exist, just return nil. this @@ -94,7 +94,7 @@ func loadFile(filename string) ([]byte, error) { } func configWrite(filename string, data []byte) error { - fullname := filepath.Join(os.Getenv("FORGE_CONFIG"), filename) + fullname := filepath.Join(os.Getenv("FORGE_GOSRC"), filename) cfgfile, err := os.OpenFile(fullname, os.O_RDWR|os.O_CREATE, 0666) defer cfgfile.Close() -- cgit v1.2.3