From daeb9127764fc9dd469294f755e277fdfca09a00 Mon Sep 17 00:00:00 2001 From: Stefan Majewsky Date: Wed, 10 Jun 2026 00:07:56 +0200 Subject: 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 --- internal/rtree/init.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'internal/rtree/init.go') 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") } } -- cgit v1.3.1