From e6a428f85f0d1c7e50dc8262a7687ec2f1ce2d7b Mon Sep 17 00:00:00 2001 From: Maran Date: Mon, 14 Jul 2014 15:25:01 +0200 Subject: [PATCH 1/5] Make the reload watcher use windows-safe paths --- ethereal/html_container.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ethereal/html_container.go b/ethereal/html_container.go index 1e835eebc..2ad06ffb5 100644 --- a/ethereal/html_container.go +++ b/ethereal/html_container.go @@ -59,7 +59,7 @@ func (app *HtmlApplication) RootFolder() string { if err != nil { return "" } - return path.Dir(folder.RequestURI()) + return path.Dir(ethutil.WindonizePath(folder.RequestURI())) } func (app *HtmlApplication) RecursiveFolders() []os.FileInfo { files, _ := ioutil.ReadDir(app.RootFolder()) From dce0ccf4902def623f33af3ce3878d1c1512101e Mon Sep 17 00:00:00 2001 From: Maran Date: Mon, 14 Jul 2014 15:29:02 +0200 Subject: [PATCH 2/5] Don't silently fail on watcher creation --- ethereal/html_container.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ethereal/html_container.go b/ethereal/html_container.go index 2ad06ffb5..04136f801 100644 --- a/ethereal/html_container.go +++ b/ethereal/html_container.go @@ -8,7 +8,6 @@ import ( "github.com/go-qml/qml" "github.com/howeyc/fsnotify" "io/ioutil" - "log" "net/url" "os" "path" @@ -77,11 +76,13 @@ func (app *HtmlApplication) NewWatcher(quitChan chan bool) { app.watcher, err = fsnotify.NewWatcher() if err != nil { + logger.Infoln("Could not create new auto-reload watcher:", err) return } err = app.watcher.Watch(app.RootFolder()) if err != nil { - log.Fatal(err) + logger.Infoln("Could not start auto-reload watcher:", err) + return } for _, folder := range app.RecursiveFolders() { fullPath := app.RootFolder() + "/" + folder.Name() From e53acdc2ac45fa8953afc3392ed81653d6f26326 Mon Sep 17 00:00:00 2001 From: Maran Date: Mon, 14 Jul 2014 16:46:00 +0200 Subject: [PATCH 3/5] Work around race condition with qt webinspector for windows builds --- ethereal/assets/qml/webapp.qml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ethereal/assets/qml/webapp.qml b/ethereal/assets/qml/webapp.qml index 401267511..5e4c035d8 100644 --- a/ethereal/assets/qml/webapp.qml +++ b/ethereal/assets/qml/webapp.qml @@ -191,6 +191,7 @@ ApplicationWindow { inspector.visible = false }else{ inspector.visible = true + inspector.url = webview.experimental.remoteInspectorUrl } } onDoubleClicked: { @@ -224,7 +225,6 @@ ApplicationWindow { WebView { id: inspector visible: false - url: webview.experimental.remoteInspectorUrl anchors { left: root.left right: root.right @@ -238,7 +238,6 @@ ApplicationWindow { name: "inspectorShown" PropertyChanges { target: inspector - url: webview.experimental.remoteInspectorUrl } } ] From c0ae5c58a6b3d78540ec19b24bd31b6e14e24191 Mon Sep 17 00:00:00 2001 From: Maran Date: Tue, 15 Jul 2014 12:52:30 +0200 Subject: [PATCH 4/5] Rewrote mnemonic word loading to facilitate deployable builds. --- ethereal/flags.go | 31 ++----------------------------- utils/cmd.go | 29 +++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 29 deletions(-) diff --git a/ethereal/flags.go b/ethereal/flags.go index d5ca9f336..c7d330f80 100644 --- a/ethereal/flags.go +++ b/ethereal/flags.go @@ -1,15 +1,13 @@ package main import ( - "bitbucket.org/kardianos/osext" "flag" "fmt" "github.com/ethereum/eth-go/ethlog" + "github.com/ethereum/go-ethereum/utils" "os" "os/user" "path" - "path/filepath" - "runtime" ) var Identifier string @@ -36,31 +34,6 @@ var LogLevel int // flags specific to gui client var AssetPath string -func defaultAssetPath() string { - var assetPath string - // 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", "ethereal") { - assetPath = path.Join(pwd, "assets") - } else { - switch runtime.GOOS { - case "darwin": - // Get Binary Directory - exedir, _ := osext.ExecutableFolder() - assetPath = filepath.Join(exedir, "../Resources") - case "linux": - assetPath = "/usr/share/ethereal" - case "windows": - assetPath = "./assets" - default: - assetPath = "." - } - } - return assetPath -} - func defaultDataDir() string { usr, _ := user.Current() return path.Join(usr.HomeDir, ".ethereal") @@ -93,7 +66,7 @@ func Init() { flag.StringVar(&DebugFile, "debug", "", "debug file (no debugging if not set)") flag.IntVar(&LogLevel, "loglevel", int(ethlog.InfoLevel), "loglevel: 0-5: silent,error,warn,info,debug,debug detail)") - flag.StringVar(&AssetPath, "asset_path", defaultAssetPath(), "absolute path to GUI assets directory") + flag.StringVar(&AssetPath, "asset_path", utils.DefaultAssetPath(), "absolute path to GUI assets directory") flag.Parse() } diff --git a/utils/cmd.go b/utils/cmd.go index 889726b04..fac164b47 100644 --- a/utils/cmd.go +++ b/utils/cmd.go @@ -1,6 +1,7 @@ package utils import ( + "bitbucket.org/kardianos/osext" "fmt" "github.com/ethereum/eth-go" "github.com/ethereum/eth-go/ethcrypto" @@ -16,6 +17,8 @@ import ( "os" "os/signal" "path" + "path/filepath" + "runtime" "time" ) @@ -164,7 +167,33 @@ func NewKeyManager(KeyStore string, Datadir string, db ethutil.Database) *ethcry return keyManager } +func DefaultAssetPath() string { + var assetPath string + // 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", "ethereal") { + assetPath = path.Join(pwd, "assets") + } else { + switch runtime.GOOS { + case "darwin": + // Get Binary Directory + exedir, _ := osext.ExecutableFolder() + assetPath = filepath.Join(exedir, "../Resources") + case "linux": + assetPath = "/usr/share/ethereal" + case "windows": + assetPath = "./assets" + default: + assetPath = "." + } + } + return assetPath +} func KeyTasks(keyManager *ethcrypto.KeyManager, KeyRing string, GenAddr bool, SecretFile string, ExportDir string, NonInteractive bool) { + ethcrypto.InitWords(DefaultAssetPath()) // Init mnemonic word list + var err error switch { case GenAddr: From 223432fa1eedb9fa5c712056afb804322aa12b02 Mon Sep 17 00:00:00 2001 From: Maran Date: Tue, 15 Jul 2014 16:21:16 +0200 Subject: [PATCH 5/5] Work around crash issues when building OSX binary --- ethereal/flags.go | 31 +++++++++++++++++++++++++++++-- utils/cmd.go | 1 + 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/ethereal/flags.go b/ethereal/flags.go index c7d330f80..c9327c3d3 100644 --- a/ethereal/flags.go +++ b/ethereal/flags.go @@ -1,13 +1,15 @@ package main import ( + "bitbucket.org/kardianos/osext" "flag" "fmt" "github.com/ethereum/eth-go/ethlog" - "github.com/ethereum/go-ethereum/utils" "os" "os/user" "path" + "path/filepath" + "runtime" ) var Identifier string @@ -34,6 +36,31 @@ var LogLevel int // flags specific to gui client var AssetPath string +//TODO: If we re-use the one defined in cmd.go the binary osx image crashes. If somebody finds out why we can dry this up. +func defaultAssetPath() string { + var assetPath string + // 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", "ethereal") { + assetPath = path.Join(pwd, "assets") + } else { + switch runtime.GOOS { + case "darwin": + // Get Binary Directory + exedir, _ := osext.ExecutableFolder() + assetPath = filepath.Join(exedir, "../Resources") + case "linux": + assetPath = "/usr/share/ethereal" + case "windows": + assetPath = "./assets" + default: + assetPath = "." + } + } + return assetPath +} func defaultDataDir() string { usr, _ := user.Current() return path.Join(usr.HomeDir, ".ethereal") @@ -66,7 +93,7 @@ func Init() { flag.StringVar(&DebugFile, "debug", "", "debug file (no debugging if not set)") flag.IntVar(&LogLevel, "loglevel", int(ethlog.InfoLevel), "loglevel: 0-5: silent,error,warn,info,debug,debug detail)") - flag.StringVar(&AssetPath, "asset_path", utils.DefaultAssetPath(), "absolute path to GUI assets directory") + flag.StringVar(&AssetPath, "asset_path", defaultAssetPath(), "absolute path to GUI assets directory") flag.Parse() } diff --git a/utils/cmd.go b/utils/cmd.go index fac164b47..1e1599582 100644 --- a/utils/cmd.go +++ b/utils/cmd.go @@ -191,6 +191,7 @@ func DefaultAssetPath() string { } return assetPath } + func KeyTasks(keyManager *ethcrypto.KeyManager, KeyRing string, GenAddr bool, SecretFile string, ExportDir string, NonInteractive bool) { ethcrypto.InitWords(DefaultAssetPath()) // Init mnemonic word list