Commit 2a9aa1e7 authored by Jochen Sprickerhof's avatar Jochen Sprickerhof

Remove patches (implemented upstream)

parent 306c594b
From: Jochen Sprickerhof <jspricke@debian.org>
Date: Fri, 19 May 2017 21:31:51 +0200
Subject: Replace basedir dependency by implementation
Take from:
https://github.com/mvdan/basedir/commit/9988eb38426ccd70e0eeeced8c2fc04d9cc4133b
---
cmd/fdroidcl/main.go | 27 ++++++++++++++++++++++++---
1 file changed, 24 insertions(+), 3 deletions(-)
diff --git a/cmd/fdroidcl/main.go b/cmd/fdroidcl/main.go
index 35a05fb..977e25c 100644
--- a/cmd/fdroidcl/main.go
+++ b/cmd/fdroidcl/main.go
@@ -11,7 +11,7 @@ import (
"path/filepath"
"strings"
- "github.com/mvdan/basedir"
+ "os/user"
)
const cmdName = "fdroidcl"
@@ -31,8 +31,29 @@ func subdir(dir, name string) string {
return p
}
+func firstGetenv(def string, evs ...string) string {
+ for _, ev := range evs {
+ if v := os.Getenv(ev); v != "" {
+ return v
+ }
+ }
+ home, err := homeDir()
+ if err != nil {
+ return ""
+ }
+ return filepath.Join(home, def)
+}
+
+func homeDir() (string, error) {
+ curUser, err := user.Current()
+ if err != nil {
+ return "", err
+ }
+ return curUser.HomeDir, nil
+}
+
func mustCache() string {
- dir := basedir.Cache()
+ dir := firstGetenv(".cache", "XDG_CACHE_HOME")
if dir == "" {
errExit("Could not determine cache dir\n")
}
@@ -40,7 +61,7 @@ func mustCache() string {
}
func mustData() string {
- dir := basedir.Data()
+ dir := firstGetenv(".config", "XDG_CONFIG_HOME")
if dir == "" {
errExit("Could not determine data dir\n")
}
0001-Replace-basedir-dependency-by-implementation.patch
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment