diff --git a/pkg/cluster/spec/profile.go b/pkg/cluster/spec/profile.go index 2b59532e28..7ad4ba7c5d 100644 --- a/pkg/cluster/spec/profile.go +++ b/pkg/cluster/spec/profile.go @@ -61,11 +61,12 @@ func Initialize(base string) error { tiupData := os.Getenv(tiuplocaldata.EnvNameComponentDataDir) tiupHome := os.Getenv(tiuplocaldata.EnvNameHome) - if tiupData != "" { + switch { + case tiupData != "": profileDir = tiupData - } else if tiupHome != "" { + case tiupHome != "": profileDir = path.Join(tiupHome, tiuplocaldata.StorageParentDir, base) - } else { + default: homeDir, err := getHomeDir() if err != nil { return errors.Trace(err)