From d37f81b5fbbbdd58881df5fd3d34358c821297e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Mart=C3=AD?= Date: Wed, 28 Sep 2016 20:55:13 +0100 Subject: [PATCH] Export Apk.RepoURL to make it show up in the cache Also useful to have it exported. Bump the cache version since current caches don't have the repo url at all. Fixes #19 (again). --- cmd/fdroidcl/update.go | 2 +- index.go | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/cmd/fdroidcl/update.go b/cmd/fdroidcl/update.go index a07f87c..91b3733 100644 --- a/cmd/fdroidcl/update.go +++ b/cmd/fdroidcl/update.go @@ -143,7 +143,7 @@ func indexPath(name string) string { return filepath.Join(mustData(), name+".jar") } -const cacheVersion = 1 +const cacheVersion = 2 type cache struct { Version int diff --git a/index.go b/index.go index 91188f4..b569af3 100644 --- a/index.go +++ b/index.go @@ -86,7 +86,7 @@ func (a *App) IconURLForDensity(density IconDensity) string { if len(a.Apks) == 0 { return "" } - return fmt.Sprintf("%s/%s/%s", a.Apks[0].repoURL, + return fmt.Sprintf("%s/%s/%s", a.Apks[0].RepoURL, getIconsDir(density), a.Icon) } @@ -196,15 +196,15 @@ type Apk struct { Hash HexHash `xml:"hash"` AppID string `xml:"-"` - repoURL string `xml:"-"` + RepoURL string `xml:"-"` } func (a *Apk) URL() string { - return fmt.Sprintf("%s/%s", a.repoURL, a.ApkName) + return fmt.Sprintf("%s/%s", a.RepoURL, a.ApkName) } func (a *Apk) SrcURL() string { - return fmt.Sprintf("%s/%s", a.repoURL, a.SrcName) + return fmt.Sprintf("%s/%s", a.RepoURL, a.SrcName) } func (a *Apk) IsCompatibleABI(ABIs []string) bool { @@ -260,7 +260,7 @@ func LoadIndexXML(r io.Reader) (*Index, error) { for j := range app.Apks { apk := &app.Apks[j] apk.AppID = app.ID - apk.repoURL = index.Repo.URL + apk.RepoURL = index.Repo.URL } } return &index, nil