mirror of
https://github.com/v2fly/v2ray-core.git
synced 2025-12-26 20:15:26 -05:00
use external config converter first, and then fallback to the internal one
This commit is contained in:
@@ -45,14 +45,16 @@ func NormalizeEnvName(name string) string {
|
||||
return strings.Replace(strings.ToUpper(strings.TrimSpace(name)), ".", "_", -1)
|
||||
}
|
||||
|
||||
func getExecutableDir() string {
|
||||
exec, err := os.Executable()
|
||||
if err != nil {
|
||||
return ""
|
||||
}
|
||||
return filepath.Dir(exec)
|
||||
}
|
||||
|
||||
func GetAssetLocation(file string) string {
|
||||
const name = "v2ray.location.asset"
|
||||
assetPath := EnvFlag{Name: name, AltName: NormalizeEnvName(name)}.GetValue(func() string {
|
||||
exec, err := os.Executable()
|
||||
if err != nil {
|
||||
return ""
|
||||
}
|
||||
return filepath.Dir(exec)
|
||||
})
|
||||
assetPath := EnvFlag{Name: name, AltName: NormalizeEnvName(name)}.GetValue(getExecutableDir)
|
||||
return filepath.Join(assetPath, file)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user