Refine environment var

Address some review comments
This commit is contained in:
yuhan6665 2023-10-28 18:21:57 -04:00
parent 999bdc58d3
commit 11b61b02c8
4 changed files with 26 additions and 31 deletions

View file

@ -15,14 +15,12 @@ func LineSeparator() string {
}
func GetToolLocation(file string) string {
const name = "xray.location.tool"
toolPath := EnvFlag{Name: name, AltName: NormalizeEnvName(name)}.GetValue(getExecutableDir)
toolPath := NewEnvFlag(ToolLocation).GetValue(getExecutableDir)
return filepath.Join(toolPath, file+".exe")
}
// GetAssetLocation searches for `file` in the excutable dir
func GetAssetLocation(file string) string {
const name = "xray.location.asset"
assetPath := NewEnvFlag(name).GetValue(getExecutableDir)
assetPath := NewEnvFlag(AssetLocation).GetValue(getExecutableDir)
return filepath.Join(assetPath, file)
}