github.com/v2fly/v2ray-core/v5@v5.16.2-0.20240507031116-8191faa6e095/common/platform/others.go (about) 1 //go:build !windows 2 // +build !windows 3 4 package platform 5 6 import ( 7 "path/filepath" 8 9 "github.com/adrg/xdg" 10 ) 11 12 func LineSeparator() string { 13 return "\n" 14 } 15 16 // GetAssetLocation search for `file` in certain locations 17 func GetAssetLocation(file string) string { 18 const name = "v2ray.location.asset" 19 assetPath := NewEnvFlag(name).GetValue(getExecutableDir) 20 defPath := filepath.Join(assetPath, file) 21 relPath := filepath.Join("v2ray", file) 22 fullPath, err := xdg.SearchDataFile(relPath) 23 if err != nil { 24 return defPath 25 } 26 return fullPath 27 }