Merge pull request #8602 from Lyndon-Li/change-udmrepo-config-to-tmp

Change udmrepo config file location to tmp
pull/8608/head^2
lyndon-li 2025-01-13 17:10:08 +08:00 committed by GitHub
commit 094ba59160
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
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"