Skip to content
This repository has been archived by the owner on Feb 7, 2022. It is now read-only.

Move cache folder to platform defined location #147

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 3 additions & 15 deletions xgo.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,27 +16,15 @@ import (
"net/http"
"os"
"os/exec"
"os/user"
"path/filepath"
"strconv"
"strings"

appdir "github.com/ProtonMail/go-appdir"
)

// Path where to cache external dependencies
var depsCache string

func init() {
// Initialize the external dependency cache path to a few possible locations
if home := os.Getenv("HOME"); home != "" {
depsCache = filepath.Join(home, ".xgo-cache")
return
}
if user, err := user.Current(); user != nil && err == nil && user.HomeDir != "" {
depsCache = filepath.Join(user.HomeDir, ".xgo-cache")
return
}
depsCache = filepath.Join(os.TempDir(), "xgo-cache")
}
var depsCache = appdir.New("xgo").UserCache()

// Cross compilation docker containers
var dockerBase = "karalabe/xgo-base"
Expand Down