From d90b71bc5518e1f794268fe58f62525302287bd3 Mon Sep 17 00:00:00 2001
From: Taylor Gerring <taylor.gerring@gmail.com>
Date: Thu, 26 Feb 2015 21:01:40 +0100
Subject: Check source directroy for assets as last resort

---
 ethutil/common.go | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

(limited to 'ethutil')

diff --git a/ethutil/common.go b/ethutil/common.go
index c4e7415dc..5fd9a06e2 100644
--- a/ethutil/common.go
+++ b/ethutil/common.go
@@ -15,11 +15,13 @@ import (
 
 func DefaultAssetPath() string {
 	var assetPath string
+	pwd, _ := os.Getwd()
+	srcdir := path.Join(os.Getenv("GOPATH"), "src", "github.com", "ethereum", "go-ethereum", "cmd", "mist")
+
 	// 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", "cmd", "mist") {
+	if pwd == srcdir {
 		assetPath = path.Join(pwd, "assets")
 	} else {
 		switch runtime.GOOS {
@@ -34,6 +36,12 @@ func DefaultAssetPath() string {
 		default:
 			assetPath = "."
 		}
+
+		// Check if the assetPath exists. If not, try the source directory
+		// This happens when binary is run from outside cmd/mist directory
+		if _, err := os.Stat(assetPath); os.IsNotExist(err) {
+			assetPath = path.Join(srcdir, "assets")
+		}
 	}
 	return assetPath
 }
-- 
cgit v1.2.3


From a39c73672efd542b53b79fdadb89afec93498cc1 Mon Sep 17 00:00:00 2001
From: Taylor Gerring <taylor.gerring@gmail.com>
Date: Thu, 26 Feb 2015 21:04:26 +0100
Subject: bump last resort check out of ifelse

---
 ethutil/common.go | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

(limited to 'ethutil')

diff --git a/ethutil/common.go b/ethutil/common.go
index 5fd9a06e2..9b66763b8 100644
--- a/ethutil/common.go
+++ b/ethutil/common.go
@@ -36,13 +36,14 @@ func DefaultAssetPath() string {
 		default:
 			assetPath = "."
 		}
+	}
 
-		// Check if the assetPath exists. If not, try the source directory
-		// This happens when binary is run from outside cmd/mist directory
-		if _, err := os.Stat(assetPath); os.IsNotExist(err) {
-			assetPath = path.Join(srcdir, "assets")
-		}
+	// Check if the assetPath exists. If not, try the source directory
+	// This happens when binary is run from outside cmd/mist directory
+	if _, err := os.Stat(assetPath); os.IsNotExist(err) {
+		assetPath = path.Join(srcdir, "assets")
 	}
+
 	return assetPath
 }
 
-- 
cgit v1.2.3