Fixed asset path error. Fixes #29
This commit is contained in:
parent
fbd53f0e34
commit
85e0447684
33
ui/ui_lib.go
33
ui/ui_lib.go
@ -5,6 +5,7 @@ import (
|
|||||||
"github.com/ethereum/eth-go"
|
"github.com/ethereum/eth-go"
|
||||||
"github.com/ethereum/eth-go/ethutil"
|
"github.com/ethereum/eth-go/ethutil"
|
||||||
"github.com/niemeyer/qml"
|
"github.com/niemeyer/qml"
|
||||||
|
"os"
|
||||||
"path"
|
"path"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"runtime"
|
"runtime"
|
||||||
@ -49,18 +50,26 @@ func (ui *UiLib) AssetPath(p string) string {
|
|||||||
|
|
||||||
func AssetPath(p string) string {
|
func AssetPath(p string) string {
|
||||||
var base string
|
var base string
|
||||||
switch runtime.GOOS {
|
|
||||||
case "darwin":
|
// If the current working directory is the go-ethereum dir
|
||||||
// Get Binary Directory
|
// assume a debug build and use the source directory as
|
||||||
exedir, _ := osext.ExecutableFolder()
|
// asset directory.
|
||||||
base = filepath.Join(exedir, "../Resources")
|
pwd, _ := os.Getwd()
|
||||||
base = "/Users/jeffrey/go/src/github.com/ethereum/go-ethereum"
|
if pwd == path.Join(os.Getenv("GOPATH"), "src", "github.com", "ethereum", "go-ethereum") {
|
||||||
case "linux":
|
base = pwd
|
||||||
base = "/usr/share/ethereal"
|
} else {
|
||||||
case "window":
|
switch runtime.GOOS {
|
||||||
fallthrough
|
case "darwin":
|
||||||
default:
|
// Get Binary Directory
|
||||||
base = "."
|
exedir, _ := osext.ExecutableFolder()
|
||||||
|
base = filepath.Join(exedir, "../Resources")
|
||||||
|
case "linux":
|
||||||
|
base = "/usr/share/ethereal"
|
||||||
|
case "window":
|
||||||
|
fallthrough
|
||||||
|
default:
|
||||||
|
base = "."
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return path.Join(base, p)
|
return path.Join(base, p)
|
||||||
|
Loading…
Reference in New Issue
Block a user