Feature: update config API support raw yaml payload

This commit is contained in:
Dreamacro
2019-12-01 13:22:47 +08:00
parent 8e10e67b89
commit 3e4bc9f85c
4 changed files with 94 additions and 60 deletions

View File

@ -3,6 +3,7 @@ package constant
import (
"os"
P "path"
"path/filepath"
)
const Name = "clash"
@ -43,6 +44,15 @@ func (p *path) Config() string {
return p.configFile
}
// Reslove return a absolute path or a relative path with homedir
func (p *path) Reslove(path string) string {
if !filepath.IsAbs(path) {
return filepath.Join(p.HomeDir(), path)
}
return path
}
func (p *path) MMDB() string {
return P.Join(p.homeDir, "Country.mmdb")
}