diff --git a/conf/conf_other.go b/conf/conf_other.go index bbb402c..5131eea 100644 --- a/conf/conf_other.go +++ b/conf/conf_other.go @@ -18,7 +18,8 @@ import ( ) func initArgs() { - flag.StringVar(&Conf.ConfigFile, "f", filepath.Dir(os.Args[0])+"/sower.toml", "config file location") + cfgFile, _ := filepath.Abs(filepath.Join(filepath.Dir(os.Args[0]), "sower.toml")) + flag.StringVar(&Conf.ConfigFile, "f", cfgFile, "config file location") flag.StringVar(&Conf.NetType, "n", "TCP", "net type (socks5 client only): "+strings.Join(transport.ListTransports(), ",")) flag.StringVar(&Conf.Cipher, "C", "AES_128_GCM", "cipher type: "+strings.Join(shadow.ListCiphers(), ",")) flag.StringVar(&Conf.Password, "p", "12345678", "password") diff --git a/conf/conf_windows.go b/conf/conf_windows.go index d7cba50..7980e43 100644 --- a/conf/conf_windows.go +++ b/conf/conf_windows.go @@ -25,7 +25,8 @@ const name = "sower" const cmdsAccepted = svc.AcceptStop | svc.AcceptShutdown | svc.AcceptPauseAndContinue func initArgs() { - flag.StringVar(&Conf.ConfigFile, "f", filepath.Dir(os.Args[0])+"\\sower.toml", "config file location") + cfgFile, _ := filepath.Abs(filepath.Join(filepath.Dir(os.Args[0]), "sower.toml")) + flag.StringVar(&Conf.ConfigFile, "f", cfgFile, "config file location") flag.BoolVar(&Conf.VersionOnly, "V", false, "print sower version") install := flag.Bool("install", false, "install sower as a service") uninstall := flag.Bool("uninstall", false, "uninstall sower from service list")