Files
Go_I2p/lib/util/home.go
ungrentquest 84cc45d3e4 Refactor config handling
- Replace low-level operations like file existance checks, file io with viper calls.
That also allows to get rid of manual config structure initialization.
- Split out UserHome() into itil/home.go to reduce code duplicacy.
- Better error handling and general readbility.
2025-03-04 23:59:38 +00:00

16 lines
240 B
Go

package util
import (
"log"
"os"
)
func UserHome() string {
homeDir, err := os.UserHomeDir()
if err != nil {
log.Fatalf("Unable to get current user's home directory. $HOME environment variable issue? %s", err)
}
return homeDir
}