summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--init.go12
-rw-r--r--plugin.go14
-rw-r--r--pluginCheck.go30
3 files changed, 19 insertions, 37 deletions
diff --git a/init.go b/init.go
index 10cdcb4..b2e9f18 100644
--- a/init.go
+++ b/init.go
@@ -11,9 +11,6 @@ import (
"go.wit.com/widget"
)
-// const Xaxis = 0 // stack things horizontally
-// const Yaxis = 1 // stack things vertically
-
func initNew() {
defer func() {
if r := recover(); r != nil {
@@ -23,9 +20,9 @@ func initNew() {
log.Log(INFO, "init() has been run")
me.counter = 0
- // me.prefix = "wit"
// Populates the top of the binary tree
+ // todo: switch this to protobuf
me.rootNode = addNode()
me.rootNode.progname = "guiBinaryTree"
me.rootNode.WidgetType = widget.Root
@@ -42,13 +39,16 @@ func initNew() {
me.guiChan = make(chan widget.Action, 1)
+ go watchCallback()
+}
+
+func colorBanner() {
version, err := getGuiVersion()
log.Printf("go.wit.com/gui %s %s %v\n", version, showVersion(), err)
if version == "" {
log.Warn("Warning: compiled without version", err)
- log.Sleep(1)
}
- go watchCallback()
+ time.Sleep(1200 * time.Millisecond) // done for effect
}
// what genius figured this out?
diff --git a/plugin.go b/plugin.go
index e07d046..3f23223 100644
--- a/plugin.go
+++ b/plugin.go
@@ -255,21 +255,13 @@ func searchPaths(name string) *aplug {
// load module
// 1. open the shared object file to load the symbols
func initToolkit(name string, filename string) *aplug {
- /*
- if _, err := os.Stat(filename); err != nil {
- if os.IsNotExist(err) {
- log.Log(PLUG, "initToolkit() missing plugin", name, "as filename", filename)
- return nil
- }
- }
- log.Log(PLUG, "initToolkit() Found plugin", name, "as filename", filename)
-
- plug, err := plugin.Open(filename)
- */
+ // smart plugin test. remove all other code besides this
if err := checkPluginViaSubprocess(filename); err != nil {
log.Printf("initToolkit() subprocess load plugin failed: %v\n", err)
return nil
}
+ // the plugin will probably work. show the banner
+ colorBanner()
plug, err := checkPlug(filename)
if err != nil {
diff --git a/pluginCheck.go b/pluginCheck.go
index f1514a3..b0369b2 100644
--- a/pluginCheck.go
+++ b/pluginCheck.go
@@ -60,19 +60,6 @@ func checkPluginCompatibility(pluginPath string) error {
return nil
}
-/*
-// tests the plugin file will load
-func testPluginOld() {
- _, err := plugin.Open(argGui.GuiPluginHack)
- if err != nil {
- log.Log(PLUG, "plugin.Open() FAILED =", argGui.GuiPluginHack, err)
- os.Exit(-1)
- }
- log.Log(PLUG, "plugin.Open() SUCCESS loading plugin =", argGui.GuiPluginHack)
- os.Exit(0)
-}
-*/
-
func CheckPlugin() string {
if argGui.GuiPluginHack != "" {
// does os.Exec() and does not return
@@ -85,26 +72,29 @@ func CheckPlugin() string {
// this is a workaround for GO plugins not cleaning up correctly after
// an attempt to load them
func TestPluginAndExit() {
- log.Log(WARN, "TEST plugin START", argGui.GuiPluginHack)
+}
+
+func TestPluginAndExitNew(hackname string) {
+ log.Log(WARN, "TEST plugin START", hackname)
- absPath, err := filepath.Abs(argGui.GuiPluginHack)
+ absPath, err := filepath.Abs(hackname)
if err != nil {
- log.Log(WARN, "TEST plugin FAILED", argGui.GuiPluginHack, absPath, err)
+ log.Log(WARN, "TEST plugin FAILED", hackname, absPath, err)
os.Exit(-1)
}
- log.Log(WARN, "TEST plugin START abs:", absPath, argGui.GuiPluginHack)
+ log.Log(WARN, "TEST plugin START abs:", absPath, hackname)
plug, err := checkPlug(absPath)
if plug == nil {
- log.Log(WARN, "TEST plugin failed (returned nil):", argGui.GuiPluginHack, absPath, err)
+ log.Log(WARN, "TEST plugin failed (returned nil):", hackname, absPath, err)
os.Exit(-1)
}
if err == nil {
- log.Log(WARN, "TEST plugin probably worked", argGui.GuiPluginHack, absPath)
+ log.Log(WARN, "TEST plugin probably worked", hackname, absPath)
log.Log(WARN, "os.Exit(0)")
os.Exit(0)
}
- log.Log(WARN, "TEST plugin failed", argGui.GuiPluginHack, absPath, err)
+ log.Log(WARN, "TEST plugin failed", hackname, absPath, err)
os.Exit(-1)
}