summaryrefslogtreecommitdiff
path: root/internal/rtree/init.go
diff options
context:
space:
mode:
authorStefan Majewsky <majewsky@gmx.net>2026-06-10 00:07:56 +0200
committerStefan Majewsky <majewsky@gmx.net>2026-06-10 00:07:56 +0200
commitdaeb9127764fc9dd469294f755e277fdfca09a00 (patch)
treeec5cd2b83e5f097527eaea985790e7ac49fa95cb /internal/rtree/init.go
parent6903a774ecbbd05596adda5e2b5e18d58dd3a8f9 (diff)
downloadgofu-daeb9127764fc9dd469294f755e277fdfca09a00.tar.gz
rtree: add support for multiple URLs per remote
This requires changing the index format, which I'm using as an opportunity to: - move from YAML to JSON (so I can maybe kill the YAML parser dependency at some point) - move the index file into standard XDG paths
Diffstat (limited to 'internal/rtree/init.go')
-rw-r--r--internal/rtree/init.go8
1 files changed, 7 insertions, 1 deletions
diff --git a/internal/rtree/init.go b/internal/rtree/init.go
index 3a8e08f..d2118c0 100644
--- a/internal/rtree/init.go
+++ b/internal/rtree/init.go
@@ -22,6 +22,11 @@ type RemoteAlias struct {
// IndexPath is where the index file is stored.
var IndexPath string
+// OldIndexPath is where the old index file was stored.
+// This is only used to detect if a system has not been upgraded to the new index format yet.
+// TODO: remove this after some time
+var OldIndexPath string
+
// RootPath is the directory below which all repositories are located. Its value
// is $GOPATH/src to match the repository layout created by `go get`.
var RootPath string
@@ -44,7 +49,8 @@ func Init() bool {
cli.Interface.ShowError("$HOME is not set (rtree needs the HOME variable to locate its index file)")
ok = false //but keep going to report all errors at once
} else {
- IndexPath = filepath.Join(homeDir, ".rtree/index.yaml")
+ IndexPath = filepath.Join(homeDir, ".config/rtree/index.json")
+ OldIndexPath = filepath.Join(homeDir, ".rtree/index.yaml")
}
}