Fixed error loops

This commit is contained in:
partisan 2025-03-02 09:59:00 +01:00
parent 44d20eb983
commit f3a78f4bd6
3 changed files with 20 additions and 22 deletions

View file

@ -78,7 +78,6 @@ func main() {
spm.Run() 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.*
<p align="center" style="font-size: 32px;"> <p align="center" style="font-size: 32px;">
<strong>License</strong> <strong>License</strong>

33
auto.go
View file

@ -196,23 +196,22 @@ func DownloadSpecified(specs []AppIndexEntry) error {
} }
fmt.Printf("[INFO] Found matching APPINDEX entry: %+v\n", *matchingEntry) fmt.Printf("[INFO] Found matching APPINDEX entry: %+v\n", *matchingEntry)
// // Check if an update is needed updateNeeded, err := IsUpdateNeeded(
// updateNeeded, err := IsUpdateNeeded( installDir,
// installDir, matchingEntry.Name,
// matchingEntry.Name, matchingEntry.Release,
// matchingEntry.Release, matchingEntry.Version,
// matchingEntry.Version, matchingEntry.Arch,
// matchingEntry.Arch, matchingEntry.OS,
// matchingEntry.OS, )
// ) if err != nil {
// if err != nil { return fmt.Errorf("[ERROR] Failed to check if update is needed for %s: %w", matchingEntry.Name, err)
// return fmt.Errorf("[ERROR] Failed to check if update is needed for %s: %w", matchingEntry.Name, err) }
// }
// if !updateNeeded { if !updateNeeded {
// fmt.Printf("[INFO] No update needed for package '%s'\n", matchingEntry.Name) fmt.Printf("[INFO] No update needed for package '%s'\n", matchingEntry.Name)
// continue continue
// } }
// 5) Download the package // 5) Download the package
downloadDir := GetTempDir() downloadDir := GetTempDir()
@ -243,7 +242,7 @@ func DownloadSpecified(specs []AppIndexEntry) error {
} }
fmt.Printf("[INFO] Package '%s' decompressed successfully to: %s\n", matchingEntry.Name, tempDir) 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) fmt.Printf("[INFO] Adding '%s' to pending updates\n", matchingEntry.Name)
pendingUpdates = append(pendingUpdates, *matchingEntry) pendingUpdates = append(pendingUpdates, *matchingEntry)
} }

View file

@ -11,13 +11,13 @@ import (
) )
// RegisterApp is not supported on non-Windows platforms. // RegisterApp is not supported on non-Windows platforms.
func RegisterApp() error { func RegisterApp() {
return fmt.Errorf("RegisterApp is only available on Windows") fmt.Println("[WARN] RegisterApp() is only available on Windows")
} }
// UnregisterApp is not supported on non-Windows platforms. // UnregisterApp is not supported on non-Windows platforms.
func UnregisterApp() error { func UnregisterApp() {
return fmt.Errorf("UnregisterApp is only available on Windows") fmt.Println("[WARN] UnregisterApp() is only available on Windows")
} }
// IsRegistered returns true if the application is detected as installed. // IsRegistered returns true if the application is detected as installed.