feat: 实现电脑端被控与控制界面
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
package paths
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
)
|
||||
|
||||
// Dir 是当前用户的本机数据目录。测试可设置 TAPREMLY_HOME。
|
||||
func Dir() (string, error) {
|
||||
if d := os.Getenv("TAPREMLY_HOME"); d != "" {
|
||||
return d, nil
|
||||
}
|
||||
if runtime.GOOS == "windows" {
|
||||
local := os.Getenv("LOCALAPPDATA")
|
||||
if local == "" {
|
||||
home, err := os.UserHomeDir()
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
local = filepath.Join(home, "AppData", "Local")
|
||||
}
|
||||
return filepath.Join(local, "TapRemly"), nil
|
||||
}
|
||||
if x := os.Getenv("XDG_DATA_HOME"); x != "" {
|
||||
return filepath.Join(x, "tapremly"), nil
|
||||
}
|
||||
home, err := os.UserHomeDir()
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return filepath.Join(home, ".local", "share", "tapremly"), nil
|
||||
}
|
||||
Reference in New Issue
Block a user