From f3a78f4bd6e8a9df88b46b7add2a359f57f07777 Mon Sep 17 00:00:00 2001 From: partisan Date: Sun, 2 Mar 2025 09:59:00 +0100 Subject: [PATCH] Fixed error loops --- README.md | 1 - auto.go | 33 ++++++++++++++++----------------- register_unix.go | 8 ++++---- 3 files changed, 20 insertions(+), 22 deletions(-) diff --git a/README.md b/README.md index 1a924b4..63f036c 100644 --- a/README.md +++ b/README.md @@ -78,7 +78,6 @@ func main() { spm.Run() } ``` -*Functions, and specifically their names, are subject to change as I really don't like "AutoDownloadSpecified," but I don't want to make it "DownloadSpecified" yet, as there are still many functions in SPM used for manual downloads, installs, etc.*

License diff --git a/auto.go b/auto.go index 491bb66..d544a44 100644 --- a/auto.go +++ b/auto.go @@ -196,23 +196,22 @@ func DownloadSpecified(specs []AppIndexEntry) error { } fmt.Printf("[INFO] Found matching APPINDEX entry: %+v\n", *matchingEntry) - // // Check if an update is needed - // updateNeeded, err := IsUpdateNeeded( - // installDir, - // matchingEntry.Name, - // matchingEntry.Release, - // matchingEntry.Version, - // matchingEntry.Arch, - // matchingEntry.OS, - // ) - // if err != nil { - // return fmt.Errorf("[ERROR] Failed to check if update is needed for %s: %w", matchingEntry.Name, err) - // } + updateNeeded, err := IsUpdateNeeded( + installDir, + matchingEntry.Name, + matchingEntry.Release, + matchingEntry.Version, + matchingEntry.Arch, + matchingEntry.OS, + ) + if err != nil { + return fmt.Errorf("[ERROR] Failed to check if update is needed for %s: %w", matchingEntry.Name, err) + } - // if !updateNeeded { - // fmt.Printf("[INFO] No update needed for package '%s'\n", matchingEntry.Name) - // continue - // } + if !updateNeeded { + fmt.Printf("[INFO] No update needed for package '%s'\n", matchingEntry.Name) + continue + } // 5) Download the package downloadDir := GetTempDir() @@ -243,7 +242,7 @@ func DownloadSpecified(specs []AppIndexEntry) error { } fmt.Printf("[INFO] Package '%s' decompressed successfully to: %s\n", matchingEntry.Name, tempDir) - // 7) Store in pendingUpdates for InstallUpdates + // Add to pendingUpdates for InstallUpdates fmt.Printf("[INFO] Adding '%s' to pending updates\n", matchingEntry.Name) pendingUpdates = append(pendingUpdates, *matchingEntry) } diff --git a/register_unix.go b/register_unix.go index d3911bf..fb860ee 100644 --- a/register_unix.go +++ b/register_unix.go @@ -11,13 +11,13 @@ import ( ) // RegisterApp is not supported on non-Windows platforms. -func RegisterApp() error { - return fmt.Errorf("RegisterApp is only available on Windows") +func RegisterApp() { + fmt.Println("[WARN] RegisterApp() is only available on Windows") } // UnregisterApp is not supported on non-Windows platforms. -func UnregisterApp() error { - return fmt.Errorf("UnregisterApp is only available on Windows") +func UnregisterApp() { + fmt.Println("[WARN] UnregisterApp() is only available on Windows") } // IsRegistered returns true if the application is detected as installed.