waveterm/pkg/scbase/scbase.go

22 lines
336 B
Go
Raw Normal View History

2022-07-01 02:02:19 +02:00
package scbase
import (
"os"
"path"
)
const HomeVarName = "HOME"
const ScHomeVarName = "SCRIPTHAUS_HOME"
func GetScHomeDir() string {
scHome := os.Getenv(ScHomeVarName)
if scHome == "" {
homeVar := os.Getenv(HomeVarName)
if homeVar == "" {
homeVar = "/"
}
scHome = path.Join(homeVar, "scripthaus")
}
return scHome
}