diff --git a/Makefile b/Makefile index d5c5ffa3..96b5b98d 100644 --- a/Makefile +++ b/Makefile @@ -13,7 +13,7 @@ def: @ [ -f src/binpack.go ] || echo "package main" > src/binpack.go app: def - CGO_ENABLED=1 go build -v -o usr/publish/contexts.app/Contents/MacOS/contexts src/webview.go src/version.go src/binpack.go && ./${binarys} forever stop && sleep 1 && open usr/publish/contexts.app + CGO_ENABLED=1 go build -v -o usr/publish/contexts.app/Contents/MacOS/contexts src/webview.go src/version.go src/binpack.go && ./${binarys} forever restart &>/dev/null # hdiutil create usr/publish/tmp.dmg -ov -volname "ContextsInstall" -fs HFS+ -srcfolder "usr/publish/contexts.app" # rm -f usr/publish/ContextsInstall.dmg # hdiutil convert usr/publish/tmp.dmg -format UDZO -o usr/publish/ContextsInstall.dmg diff --git a/src/webview.go b/src/webview.go index 25d31d19..35e60502 100644 --- a/src/webview.go +++ b/src/webview.go @@ -5,6 +5,7 @@ import ( "time" "shylinux.com/x/ice" + "shylinux.com/x/icebergs/base/cli" "shylinux.com/x/icebergs/base/tcp" "shylinux.com/x/icebergs/base/web" "shylinux.com/x/icebergs/misc/webview" @@ -14,8 +15,15 @@ import ( type view struct{ *webview.WebView } func main() { - os.Chdir(kit.HomePath(ice.CONTEXTS)) - go ice.Run(web.SERVE, tcp.START) - time.Sleep(time.Second) - webview.Run(func(w *webview.WebView) ice.Any { return view{w} }) + if os.Chdir(kit.HomePath(ice.CONTEXTS)); len(os.Args) == 1 { + for { + if ice.Run(cli.SYSTEM, os.Args[0], "webview"); cli.IsSuccess(ice.Pulse) { + break + } + } + } else { + go ice.Run(web.SERVE, tcp.START) + time.Sleep(time.Second) + webview.Run(func(w *webview.WebView) ice.Any { return view{w} }) + } } diff --git a/src/webview.txt b/src/webview.txt index 4e8a9db3..1ed2d3ab 100644 --- a/src/webview.txt +++ b/src/webview.txt @@ -1,3 +1,3 @@ -localhost http://localhost:9020 shylinux https://shylinux.com -vimer "http://localhost:9020/chat/cmd/web.code.vimer?topic=black&path=src/,usr/icebergs/,usr/volcanos/&file=main.go#src/,main.go,1" +localhost http://localhost:9020 +vimer "http://localhost:9020/chat/cmd/web.code.vimer?topic=black&path=src/,usr/icebergs/,usr/volcanos/&file=main.go"