Init
This commit is contained in:
commit
d0187f94d7
23 changed files with 2489 additions and 0 deletions
26
spm/utils.go
Normal file
26
spm/utils.go
Normal file
|
@ -0,0 +1,26 @@
|
|||
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
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue