diff options
| author | Jeff Carr <[email protected]> | 2025-09-03 01:19:51 -0500 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-09-03 01:19:51 -0500 |
| commit | 09e94187bfbabdfad3a41e0b2a8b56d4e55650ca (patch) | |
| tree | 229a7a906657f04a67aece19a5b3d7859d069a85 | |
| parent | e657015a78ddf9b9ae6cc0fbe90dd72c1a25291a (diff) | |
redo order in which the plugins are searchedv0.22.49
Now that this verifies the plugin will load by
os.Exec() loading the plugin, this bypasses the current
problems with GO not being able to retry loading the
plugin. Now it can return to testing the ones that
were built locally by the user before the system
or distribution packaged default plugins.
| -rw-r--r-- | init.go | 1 | ||||
| -rw-r--r-- | plugin.go | 70 |
2 files changed, 37 insertions, 34 deletions
@@ -384,6 +384,7 @@ func (n *Node) StandardExit() { log.Log(INFO, "StandardExit() attempt to exit each toolkit plugin") for i, plug := range allPlugins { log.Log(INFO, "NewButton()", i, plug) + n.CloseToolkit(plug.name) } log.Exit(0) } @@ -148,20 +148,47 @@ func searchPaths(name string) *aplug { var filename string var pfile []byte var err error + var p *aplug // try the filename from the command line first if argGui.GuiFile != "" { - p := initToolkit(name, argGui.GuiFile) + p = initToolkit(name, argGui.GuiFile) if p != nil { log.Log(NOW, "gui.Init() loaded ok!", argGui.GuiFile) return p } } - // This is the 'default' location - // if you are a linux distribution package maintainer, please put the tookits here - filename = "/usr/lib/go-gui-toolkits/" + name + ".so" - p := initToolkit(name, filename) + // check for custom toolkit builds. This looks: + // with 'go build': ~/go/src/go.wit.com/toolkits/gocui/gocui.go + // with 'make install': ~/go/lib/go-gui/gocui.go + // + // TODO: use forge to find the "go.work" dir + // TODO: fix 'go install' to support building plugins + homeDir, err := os.UserHomeDir() + if err != nil { + log.Error(err, "os.UserHomeDir() error", err) + } else { + // first look in the toolkit build directory + filename = homeDir + "/go/src/go.wit.com/toolkits/" + name + "/" + name + ".so" + p = initToolkit(name, filename) + if p != nil { + log.Log(NOW, "gui.Init() loaded", filename, "ok!") + return p + } + + // this is the "default" location when built and installed locally + filename = homeDir + "/go/lib/go-gui/" + name + ".so" + p = initToolkit(name, filename) + if p != nil { + log.Log(NOW, "gui.Init() loaded", filename, "ok!") + return p + } + } + + // try /usr/local/ + filename = "/usr/local/lib/go-gui/" + name + ".so" + p = initToolkit(name, filename) if p != nil { log.Log(NOW, "gui.Init() loaded", filename, "ok!") return p @@ -196,40 +223,15 @@ func searchPaths(name string) *aplug { return p } - // check for custom toolkit builds. This looks: - // with 'go build': ~/go/src/go.wit.com/toolkits/gocui/gocui.go - // with 'make install': ~/go/lib/go-gui/gocui.go - // - // TODO: use forge to find the "go.work" dir - // TODO: fix 'go install' to support building plugins - homeDir, err := os.UserHomeDir() - if err != nil { - log.Error(err, "os.UserHomeDir() error", err) - } else { - // first look in the toolkit build directory - filename = homeDir + "/go/src/go.wit.com/toolkits/" + name + "/" + name + ".so" - p = initToolkit(name, filename) - if p != nil { - log.Log(NOW, "gui.Init() loaded", filename, "ok!") - return p - } - - // this is the "default" location when built and installed locally - filename = homeDir + "/go/lib/go-gui/" + name + ".so" - p = initToolkit(name, filename) - if p != nil { - log.Log(NOW, "gui.Init() loaded", filename, "ok!") - return p - } - } - - // try /usr/local/ - filename = "/usr/local/lib/go-gui/" + name + ".so" + // This is the 'default' location + // if you are a linux distribution package maintainer, please put the tookits here + filename = "/usr/lib/go-gui-toolkits/" + name + ".so" p = initToolkit(name, filename) if p != nil { log.Log(NOW, "gui.Init() loaded", filename, "ok!") return p } + return nil } |
