From b00203d3de3467a069da78891483656ab967a6e5 Mon Sep 17 00:00:00 2001 From: yangjh Date: Thu, 6 Dec 2018 11:23:41 +0800 Subject: [PATCH] 20181206 --- main.go | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/main.go b/main.go index 17deef6..dcdfc27 100644 --- a/main.go +++ b/main.go @@ -13,6 +13,7 @@ import ( "os" "path/filepath" "runtime" + "strings" ) var currentServerName string @@ -142,8 +143,17 @@ func setAutoRun() bool { return false } fmt.Println(dir) + split := strings.Split(os.Args[0], string(os.PathSeparator)) + exeName := "" + if len(split) > 0 { + fmt.Println(split[len(split)-1]) + exeName = split[len(split)-1] + } else { + exeName = os.Args[0] + } + fmt.Println(exeName) - var exec = dir + string(os.PathSeparator) + os.Args[0] + var exec = dir + string(os.PathSeparator) + exeName app := &autostart.App{ Name: "goproxy-gui", DisplayName: "goproxy的图形界面", @@ -170,7 +180,17 @@ func unSetAutoRun() bool { return false } fmt.Println(dir) - var exec = dir + string(os.PathSeparator) + os.Args[0] + split := strings.Split(os.Args[0], string(os.PathSeparator)) + exeName := "" + if len(split) > 0 { + fmt.Println(split[len(split)-1]) + exeName = split[len(split)-1] + } else { + exeName = os.Args[0] + } + fmt.Println(exeName) + + var exec = dir + string(os.PathSeparator) + exeName app := &autostart.App{ Name: "goproxy-gui", DisplayName: "goproxy的图形界面",