1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-11-08 03:07:47 -05:00
v2fly/common/platform/others.go

28 lines
541 B
Go
Raw Normal View History

//go:build !windows
2015-10-09 10:48:05 -04:00
// +build !windows
package platform
import (
"path/filepath"
2015-10-09 10:48:05 -04:00
"github.com/adrg/xdg"
)
2015-10-09 10:48:05 -04:00
2015-10-13 15:41:53 -04:00
func LineSeparator() string {
return "\n"
2015-10-09 10:48:05 -04:00
}
2020-08-17 06:56:01 -04:00
// GetAssetLocation search for `file` in certain locations
func GetAssetLocation(file string) string {
const name = "v2ray.location.asset"
assetPath := NewEnvFlag(name).GetValue(getExecutableDir)
defPath := filepath.Join(assetPath, file)
relPath := filepath.Join("v2ray", file)
fullPath, err := xdg.SearchDataFile(relPath)
if err != nil {
return defPath
2020-08-17 06:56:01 -04:00
}
return fullPath
2020-08-17 06:56:01 -04:00
}