Skip to content

Commit

Permalink
Create LaunchAgents/ directory if it doesn't exist (MacOS) (#811)
Browse files Browse the repository at this point in the history
Signed-off-by: Tristan B <tristan@infi.im>
  • Loading branch information
xplato authored Aug 28, 2023
1 parent 604da4a commit 6c5dfae
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion config/autostart.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,15 @@ var launchdAgentDefinition []byte

// getLaunchdAgentPath will return the path of the launchd agent default path
func getLaunchdAgentPath() *paths.Path {
return GetDefaultHomeDir().Join("Library", "LaunchAgents", "ArduinoCreateAgent.plist")
homeDir := GetDefaultHomeDir()
launchAgentsPath := homeDir.Join("Library", "LaunchAgents")
agentPlistPath := launchAgentsPath.Join("ArduinoCreateAgent.plist")

if err := os.MkdirAll(launchAgentsPath.String(), 0755); err != nil {
log.Panicf("Could not create ~/Library/LaunchAgents directory: %s", err)
}

return agentPlistPath
}

// InstallPlistFile will handle the process of creating the plist file required for the autostart
Expand Down

1 comment on commit 6c5dfae

@Johnydeepwick
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I

Please sign in to comment.