mirror of
https://github.com/v2fly/v2ray-core.git
synced 2024-11-18 02:16:10 -05:00
118a99e773
* common/platform: cleanup unused functions * common/platform: search for assets in xdg data directories on non-windows platforms
28 lines
541 B
Go
28 lines
541 B
Go
//go:build !windows
|
|
// +build !windows
|
|
|
|
package platform
|
|
|
|
import (
|
|
"path/filepath"
|
|
|
|
"github.com/adrg/xdg"
|
|
)
|
|
|
|
func LineSeparator() string {
|
|
return "\n"
|
|
}
|
|
|
|
// 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
|
|
}
|
|
return fullPath
|
|
}
|