Installer/spm/utils.go
partisan 48473f98c5
All checks were successful
/ test-on-windows (push) Successful in 12s
/ test-on-alpine (push) Successful in 1m13s
updated spm package
2025-02-04 17:14:00 +01:00

26 lines
812 B
Go

package spm
import (
"os/exec"
)
// persistSystemEnvVar sets a persistent environment variable on Windows using the `setx` command.
// Perhaps support for other systems would be needed, but all of this "Launcher" thingy is probably going to end up
// being Windows-specific, as other superior systems have their own package managers.
func persistSystemEnvVar(key, value string) error {
cmd := exec.Command("cmd", "/C", "setx", key, value)
err := cmd.Run()
if err != nil {
return err
}
return nil
}
// IsMatchingEntry checks if a package entry matches the requested specs
func IsMatchingEntry(e AppIndexEntry, name, release, arch, osName, pkgType string) bool {
return e.Name == name &&
e.Release == release &&
e.Arch == arch &&
e.OS == osName &&
e.Type == pkgType
}