2021-08-21 01:20:40 -04:00
|
|
|
//go:build !windows
|
2015-10-09 10:48:05 -04:00
|
|
|
// +build !windows
|
|
|
|
|
|
|
|
package platform
|
|
|
|
|
|
|
|
import (
|
2017-11-11 16:29:00 -05:00
|
|
|
"path/filepath"
|
2015-10-09 10:48:05 -04:00
|
|
|
|
2022-02-06 01:24:23 -05: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
|
|
|
}
|
2017-11-11 16:29:00 -05: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)
|
2022-02-06 01:24:23 -05:00
|
|
|
relPath := filepath.Join("v2ray", file)
|
|
|
|
fullPath, err := xdg.SearchDataFile(relPath)
|
|
|
|
if err != nil {
|
|
|
|
return defPath
|
2020-08-17 06:56:01 -04:00
|
|
|
}
|
2022-02-06 01:24:23 -05:00
|
|
|
return fullPath
|
2020-08-17 06:56:01 -04:00
|
|
|
}
|