change udmrepo config file location to tmp

Signed-off-by: Lyndon-Li <lyonghui@vmware.com>
pull/8602/head
Lyndon-Li 2025-01-10 16:40:21 +08:00
parent 46b8a31ef0
commit e79dbb8d60
2 changed files with 7 additions and 1 deletions

View File

@ -0,0 +1 @@
Fix issue #8067, add tmp folder (/tmp for linux, C:\Windows\Temp for Windows) as an alternative of udmrepo's config file location

View File

@ -200,7 +200,12 @@ func GetRepoDomain() string {
func getRepoConfigFile(workPath string, repoID string) string {
if workPath == "" {
workPath = filepath.Join(os.Getenv("HOME"), "udmrepo")
home := os.Getenv("HOME")
if home != "" {
workPath = filepath.Join(home, "udmrepo")
} else {
workPath = filepath.Join(os.TempDir(), "udmrepo")
}
}
name := "repo-" + strings.ToLower(repoID) + ".conf"