rime-ice/others/script/rime/dir_mac.go

31 lines
499 B
Go
Raw Normal View History

2024-04-18 20:00:36 +02:00
//go:build darwin
// +build darwin
package rime
import (
"log"
"os/user"
"path/filepath"
"runtime"
)
// 获取 macOS/Windows Rime 配置目录
func getRimeDir() string {
var dir string
switch runtime.GOOS {
case "darwin": // macOS
u, err := user.Current()
if err != nil {
log.Fatalln(err)
}
dir = filepath.Join(u.HomeDir, "Library/Rime")
// case "windows": // Windows
// dir = getWeaselDir()
default:
log.Fatalf("Unsupported OS: %s so far", runtime.GOOS)
}
return dir
}