summaryrefslogtreecommitdiff
path: root/config.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2024-12-07 16:50:26 -0600
committerJeff Carr <[email protected]>2024-12-07 16:50:26 -0600
commitcb04f3585c1abe95f6bddfa282e829896c2bb19a (patch)
tree782b14c818e267d23daeb797975777f12279a0af /config.go
parent945ae6329b7e4e46e409027984253e358ee87260 (diff)
debugging switching go/src dirsv0.0.27
Diffstat (limited to 'config.go')
-rw-r--r--config.go14
1 files changed, 7 insertions, 7 deletions
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()