func (p *program) Init(env svc.Environment) error { if env.IsWindowsService() { dir := filepath.Dir(os.Args[0]) return os.Chdir(dir) } return nil }
func (p *program) Init(env svc.Environment) error { if env.IsWindowsService() { //判断操作系统 dir := filepath.Dir(os.Args[0]) return os.Chdir(dir) //改变当前工作目录到指定的目录中 } return nil }
func (ed *entranced) Init(env svc.Environment) error { if env.IsWindowsService() { dir := filepath.Dir(os.Args[0]) return os.Chdir(dir) } log.Println("init") return nil }