aboutsummaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2014-03-17 01:34:34 +0800
committerobscuren <geffobscura@gmail.com>2014-03-17 01:34:34 +0800
commit85e04476845a5a41836824b133d939faf4e1c3fa (patch)
treeac56b3a3be83ac694135e225d4ceb503e8d35d47 /ui
parentfbd53f0e34b636074941f5ea7b151bf173c5ed17 (diff)
downloadgo-tangerine-85e04476845a5a41836824b133d939faf4e1c3fa.tar
go-tangerine-85e04476845a5a41836824b133d939faf4e1c3fa.tar.gz
go-tangerine-85e04476845a5a41836824b133d939faf4e1c3fa.tar.bz2
go-tangerine-85e04476845a5a41836824b133d939faf4e1c3fa.tar.lz
go-tangerine-85e04476845a5a41836824b133d939faf4e1c3fa.tar.xz
go-tangerine-85e04476845a5a41836824b133d939faf4e1c3fa.tar.zst
go-tangerine-85e04476845a5a41836824b133d939faf4e1c3fa.zip
Fixed asset path error. Fixes #29
Diffstat (limited to 'ui')
-rw-r--r--ui/ui_lib.go33
1 files changed, 21 insertions, 12 deletions
diff --git a/ui/ui_lib.go b/ui/ui_lib.go
index 2a1abee23..83e8bf2d1 100644
--- a/ui/ui_lib.go
+++ b/ui/ui_lib.go
@@ -5,6 +5,7 @@ import (
"github.com/ethereum/eth-go"
"github.com/ethereum/eth-go/ethutil"
"github.com/niemeyer/qml"
+ "os"
"path"
"path/filepath"
"runtime"
@@ -49,18 +50,26 @@ func (ui *UiLib) AssetPath(p string) string {
func AssetPath(p string) string {
var base string
- switch runtime.GOOS {
- case "darwin":
- // Get Binary Directory
- exedir, _ := osext.ExecutableFolder()
- base = filepath.Join(exedir, "../Resources")
- base = "/Users/jeffrey/go/src/github.com/ethereum/go-ethereum"
- case "linux":
- base = "/usr/share/ethereal"
- case "window":
- fallthrough
- default:
- base = "."
+
+ // If the current working directory is the go-ethereum dir
+ // assume a debug build and use the source directory as
+ // asset directory.
+ pwd, _ := os.Getwd()
+ if pwd == path.Join(os.Getenv("GOPATH"), "src", "github.com", "ethereum", "go-ethereum") {
+ base = pwd
+ } else {
+ switch runtime.GOOS {
+ case "darwin":
+ // Get Binary Directory
+ exedir, _ := osext.ExecutableFolder()
+ base = filepath.Join(exedir, "../Resources")
+ case "linux":
+ base = "/usr/share/ethereal"
+ case "window":
+ fallthrough
+ default:
+ base = "."
+ }
}
return path.Join(base, p)