Skip to content

Remove installbuilder from macos release artifact #785

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

Merged
merged 16 commits into from
May 19, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
"encoding/json"
"flag"
"os"
"os/exec"
"runtime"
"runtime/debug"
"strconv"
Expand Down Expand Up @@ -168,6 +169,15 @@ func loop() {
log.SetLevel(log.InfoLevel)
log.SetOutput(os.Stdout)

// We used to install the agent in $HOME/Applications before versions <= 1.2.7-ventura
// With version > 1.3.0 we changed the install path of the agent in /Applications.
// If we are updating manually from 1.2.7 to 1.3.0 we have to uninstall the old agent manually first.
// This check will inform the user if he needs to run the uninstall first
if runtime.GOOS == "darwin" && oldInstallExists() {
printDialog("Old agent installation of the Arduino Create Agent found, please uninstall it before launching the new one")
os.Exit(0)
}

// Instantiate Tools
Tools = tools.Tools{
Directory: config.GetDataDir().String(),
Expand Down Expand Up @@ -434,6 +444,18 @@ func loop() {
}()
}

// oldInstallExixts will return true if an old installation of the agent exixts (on macos)
func oldInstallExists() bool {
oldAgentPath := config.GetDefaultHomeDir().Join("Applications", "ArduinoCreateAgent")
return oldAgentPath.Exist()
}

// printDialog will print a GUI error dialog on macos
func printDialog(dialogText string) {
oscmd := exec.Command("osascript", "-e", "display dialog \""+dialogText+"\" buttons \"OK\" with title \"Error\"")
_ = oscmd.Run()
}

func parseIni(filename string) (args []string, err error) {
cfg, err := ini.LoadSources(ini.LoadOptions{IgnoreInlineComment: false, AllowPythonMultilineValues: true}, filename)
if err != nil {
Expand Down