@@ -38,11 +38,11 @@ func getLaunchdAgentPath() *paths.Path {
38
38
func InstallPlistFile () {
39
39
launchdAgentPath := getLaunchdAgentPath ()
40
40
if ! launchdAgentPath .Exist () {
41
- err := WritePlistFile (launchdAgentPath )
41
+ err := writePlistFile (launchdAgentPath )
42
42
if err != nil {
43
43
log .Error (err )
44
44
} else {
45
- err = LoadLaunchdAgent () // this will load the agent: basically starting a new instance
45
+ err = loadLaunchdAgent () // this will load the agent: basically starting a new instance
46
46
if err != nil {
47
47
log .Error (err )
48
48
} else {
@@ -57,10 +57,10 @@ func InstallPlistFile() {
57
57
}
58
58
}
59
59
60
- // WritePlistFile function will write the required plist file to launchdAgentPath
60
+ // writePlistFile function will write the required plist file to launchdAgentPath
61
61
// it will return nil in case of success,
62
62
// it will error in any other case
63
- func WritePlistFile (launchdAgentPath * paths.Path ) error {
63
+ func writePlistFile (launchdAgentPath * paths.Path ) error {
64
64
src , err := os .Executable ()
65
65
66
66
if err != nil {
@@ -81,37 +81,37 @@ func WritePlistFile(launchdAgentPath *paths.Path) error {
81
81
return t .Execute (plistFile , data )
82
82
}
83
83
84
- // LoadLaunchdAgent will use launchctl to load the agent, will return an error if something goes wrong
85
- func LoadLaunchdAgent () error {
84
+ // loadLaunchdAgent will use launchctl to load the agent, will return an error if something goes wrong
85
+ func loadLaunchdAgent () error {
86
86
// https://www.launchd.info/
87
87
oscmd := exec .Command ("launchctl" , "load" , getLaunchdAgentPath ().String ())
88
88
err := oscmd .Run ()
89
89
return err
90
90
}
91
91
92
92
func UninstallPlistFile () {
93
- err := UnloadLaunchdAgent ()
93
+ err := unloadLaunchdAgent ()
94
94
if err != nil {
95
95
log .Error (err )
96
96
} else {
97
- err = RemovePlistFile ()
97
+ err = removePlistFile ()
98
98
if err != nil {
99
99
log .Error (err )
100
100
}
101
101
}
102
102
}
103
103
104
- // UnloadLaunchdAgent will use launchctl to load the agent, will return an error if something goes wrong
105
- func UnloadLaunchdAgent () error {
104
+ // unloadLaunchdAgent will use launchctl to load the agent, will return an error if something goes wrong
105
+ func unloadLaunchdAgent () error {
106
106
// https://www.launchd.info/
107
107
oscmd := exec .Command ("launchctl" , "unload" , getLaunchdAgentPath ().String ())
108
108
err := oscmd .Run ()
109
109
return err
110
110
}
111
111
112
- // RemovePlistFile function will remove the plist file from $HOME/Library/LaunchAgents/ArduinoCreateAgent.plist and return an error
112
+ // removePlistFile function will remove the plist file from $HOME/Library/LaunchAgents/ArduinoCreateAgent.plist and return an error
113
113
// it will not do anything if the file is not there
114
- func RemovePlistFile () error {
114
+ func removePlistFile () error {
115
115
launchdAgentPath := getLaunchdAgentPath ()
116
116
if launchdAgentPath .Exist () {
117
117
log .Infof ("removing: %s" , launchdAgentPath )
0 commit comments