mirror of
https://github.com/simon-ding/polaris.git
synced 2026-02-22 17:21:17 +08:00
21 lines
285 B
Go
21 lines
285 B
Go
//go:build lib
|
|
|
|
package utils
|
|
|
|
import (
|
|
"os"
|
|
"path/filepath"
|
|
)
|
|
|
|
|
|
func GetUserDataDir() string {
|
|
d, err := os.UserHomeDir()
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
d = filepath.Join(d, ".polaris")
|
|
if _, err := os.Stat(d); os.IsNotExist(err) {
|
|
os.MkdirAll(d, os.ModePerm)
|
|
}
|
|
return d
|
|
} |