diff options
Diffstat (limited to 'config.go')
| -rw-r--r-- | config.go | 14 |
1 files changed, 7 insertions, 7 deletions
@@ -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() |
