mirror of
https://github.com/wavetermdev/waveterm.git
synced 2025-01-01 18:28:59 +01:00
22 lines
336 B
Go
22 lines
336 B
Go
|
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
|
||
|
}
|