fortify/internal/system/retrieve.go
Ophestra Umiker da6d238d8a
verbose: remove system package interaction
Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
2024-09-12 21:07:05 +09:00

29 lines
447 B
Go

package system
import (
"fmt"
"os"
"path"
"strconv"
)
func Retrieve() {
if V != nil {
panic("system info retrieved twice")
}
v := &Values{Share: path.Join(os.TempDir(), "fortify."+strconv.Itoa(os.Geteuid()))}
if r, ok := os.LookupEnv(xdgRuntimeDir); !ok {
fmt.Println("Env variable", xdgRuntimeDir, "unset")
// too early for fatal
os.Exit(1)
} else {
v.Runtime = r
v.RunDir = path.Join(v.Runtime, "fortify")
}
V = v
}