Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create LaunchAgents/ directory if it doesn't exist (MacOS) #811

Merged
merged 1 commit into from
Aug 28, 2023

Conversation

xplato
Copy link
Contributor

@xplato xplato commented Aug 8, 2023

  • The PR has no duplicates
  • Tests for the changes have been added (for bug fixes / features)
    • It didn't look like there were any tests for the config module—if I missed it, though, let me know! (Adding a whole test file for config at this time felt a bit out of scope imo) Happy to add them in another place though!

In the meantime, here's a quick Gist you can run to test out the changes locally: https://gist.github.com/xplato/ff85973647e9a1b5190361e331c27fe0

  • What kind of change does this PR introduce?
    This is a bug fix in the config module. On MacOS, sometimes the ~/Library/LaunchAgents/ directory does not exist—if not, this would cause the program to not start because the path to the config file would be invalid (see the end of this PR description for the relevant log/info). This will create the directory if it doesn't exist, allowing the program to run correctly.
  • What is the current behavior?
    If the ~/Library/LaunchAgents directory doesn't exist, the program will not start.
  • What is the new behavior?
    Updates the getLaunchdAgentPath function to create the ~/Library/LaunchAgents directory if it doesn't exist, returning the path as usual.
  • Does this PR introduce a breaking change?
    No (depends on how you look at it I guess 😅).
  • Other information:
    The only way I found to catch this is by deleting the ~/Library/LaunchAgents directory and running the binary manually via ArduinoCreateAgent.app -> "Show package contents" -> Contents/MacOS/Arduino_Create_Agent

The relevant log:

ERRO[0000] open /Users/$USER/Library/LaunchAgents/ArduinoCreateAgent.plist: no such file or directory

Signed-off-by: Tristan B <tristan@infi.im>
@CLAassistant
Copy link

CLAassistant commented Aug 8, 2023

CLA assistant check
All committers have signed the CLA.

@per1234 per1234 added topic: code Related to content of the project itself os: macos Specific to macOS operating system type: imperfection Perceived defect in any part of project labels Aug 8, 2023
@alessio-perugini
Copy link
Contributor

@xplato Thank you for the PR LGTM 🤩 Im asking for a second review from @umbynos since he has more context on possible gotchas on MacOS.

@umbynos
Copy link
Contributor

umbynos commented Aug 28, 2023

LGTM, thanks a lot 🙏

@umbynos umbynos merged commit 6c5dfae into arduino:main Aug 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
os: macos Specific to macOS operating system topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants