|
|
|
@@ -11,7 +11,7 @@ import (
|
|
|
|
|
"path/filepath"
|
|
|
|
|
"strings"
|
|
|
|
|
|
|
|
|
|
"turtlesilicon/pkg/debug"
|
|
|
|
|
"epochsilicon/pkg/debug"
|
|
|
|
|
|
|
|
|
|
"fyne.io/fyne/v2"
|
|
|
|
|
"fyne.io/fyne/v2/dialog"
|
|
|
|
@@ -130,7 +130,7 @@ func QuotePathForShell(path string) string {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func CheckForUpdate(currentVersion string) (latestVersion, releaseNotes string, updateAvailable bool, err error) {
|
|
|
|
|
resp, err := http.Get("https://api.github.com/repos/tairasu/TurtleSilicon/releases/latest")
|
|
|
|
|
resp, err := http.Get("https://api.github.com/repos/tairasu/EpochSilicon/releases/latest")
|
|
|
|
|
if err != nil {
|
|
|
|
|
return "", "", false, err
|
|
|
|
|
}
|
|
|
|
@@ -163,7 +163,7 @@ type Asset struct {
|
|
|
|
|
|
|
|
|
|
// CheckForUpdateWithAssets returns update information including download assets
|
|
|
|
|
func CheckForUpdateWithAssets(currentVersion string) (*UpdateInfo, bool, error) {
|
|
|
|
|
resp, err := http.Get("https://api.github.com/repos/tairasu/TurtleSilicon/releases/latest")
|
|
|
|
|
resp, err := http.Get("https://api.github.com/repos/tairasu/EpochSilicon/releases/latest")
|
|
|
|
|
if err != nil {
|
|
|
|
|
return nil, false, err
|
|
|
|
|
}
|
|
|
|
@@ -201,7 +201,7 @@ func CheckForUpdateWithAssets(currentVersion string) (*UpdateInfo, bool, error)
|
|
|
|
|
// DownloadUpdate downloads the latest release and returns the path to the downloaded file
|
|
|
|
|
func DownloadUpdate(downloadURL string, progressCallback func(downloaded, total int64)) (string, error) {
|
|
|
|
|
// Create temporary file
|
|
|
|
|
tempFile, err := os.CreateTemp("", "TurtleSilicon-update-*.dmg")
|
|
|
|
|
tempFile, err := os.CreateTemp("", "EpochSilicon-update-*.dmg")
|
|
|
|
|
if err != nil {
|
|
|
|
|
return "", fmt.Errorf("failed to create temp file: %v", err)
|
|
|
|
|
}
|
|
|
|
@@ -349,12 +349,12 @@ func InstallUpdate(dmgPath string) error {
|
|
|
|
|
var newAppPath string
|
|
|
|
|
|
|
|
|
|
// First, try the exact name
|
|
|
|
|
exactPath := filepath.Join(mountPoint, "TurtleSilicon.app")
|
|
|
|
|
exactPath := filepath.Join(mountPoint, "EpochSilicon.app")
|
|
|
|
|
if PathExists(exactPath) {
|
|
|
|
|
newAppPath = exactPath
|
|
|
|
|
} else {
|
|
|
|
|
// Search for any .app bundle in the mount point
|
|
|
|
|
debug.Printf("TurtleSilicon.app not found at exact path, searching for .app bundles")
|
|
|
|
|
debug.Printf("EpochSilicon.app not found at exact path, searching for .app bundles")
|
|
|
|
|
entries, err := os.ReadDir(mountPoint)
|
|
|
|
|
if err != nil {
|
|
|
|
|
return fmt.Errorf("failed to read DMG contents: %v", err)
|
|
|
|
@@ -406,7 +406,7 @@ func InstallUpdate(dmgPath string) error {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Fix executable permissions for the main binary
|
|
|
|
|
executablePath := filepath.Join(currentAppPath, "Contents", "MacOS", "turtlesilicon")
|
|
|
|
|
executablePath := filepath.Join(currentAppPath, "Contents", "MacOS", "epochsilicon")
|
|
|
|
|
if PathExists(executablePath) {
|
|
|
|
|
debug.Printf("Setting executable permissions for: %s", executablePath)
|
|
|
|
|
if err := os.Chmod(executablePath, 0755); err != nil {
|
|
|
|
@@ -466,7 +466,7 @@ func TestDMGMount(dmgPath string) (string, string, error) {
|
|
|
|
|
if infoErr == nil {
|
|
|
|
|
infoLines := strings.Split(string(infoOutput), "\n")
|
|
|
|
|
for _, line := range infoLines {
|
|
|
|
|
if strings.Contains(line, "/Volumes/") && strings.Contains(line, "TurtleSilicon") {
|
|
|
|
|
if strings.Contains(line, "/Volumes/") && strings.Contains(line, "EpochSilicon") {
|
|
|
|
|
line = strings.TrimSpace(line)
|
|
|
|
|
if strings.HasPrefix(line, "/Volumes/") {
|
|
|
|
|
mountPoint = line
|
|
|
|
@@ -487,12 +487,12 @@ func TestDMGMount(dmgPath string) (string, string, error) {
|
|
|
|
|
var newAppPath string
|
|
|
|
|
|
|
|
|
|
// First, try the exact name
|
|
|
|
|
exactPath := filepath.Join(mountPoint, "TurtleSilicon.app")
|
|
|
|
|
exactPath := filepath.Join(mountPoint, "EpochSilicon.app")
|
|
|
|
|
if PathExists(exactPath) {
|
|
|
|
|
newAppPath = exactPath
|
|
|
|
|
} else {
|
|
|
|
|
// Search for any .app bundle in the mount point
|
|
|
|
|
debug.Printf("TurtleSilicon.app not found at exact path, searching for .app bundles")
|
|
|
|
|
debug.Printf("EpochSilicon.app not found at exact path, searching for .app bundles")
|
|
|
|
|
entries, err := os.ReadDir(mountPoint)
|
|
|
|
|
if err != nil {
|
|
|
|
|
// Unmount before returning error
|
|
|
|
|