feat: prefer util.WritablePath() for logs and local storage

This commit is contained in:
hkfires
2025-10-19 10:19:55 +08:00
parent 674393ec12
commit d16599fa1d
6 changed files with 57 additions and 8 deletions

View File

@@ -13,6 +13,7 @@ import (
"time"
"github.com/gin-gonic/gin"
"github.com/router-for-me/CLIProxyAPI/v6/internal/util"
)
const (
@@ -145,6 +146,9 @@ func (h *Handler) logDirectory() string {
if h.logDir != "" {
return h.logDir
}
if base := util.WritablePath(); base != "" {
return filepath.Join(base, "logs")
}
if h.configFilePath != "" {
dir := filepath.Dir(h.configFilePath)
if dir != "" && dir != "." {