From a1237ea8f0ec6f70435c6693d7cece5ff3d5c4c8 Mon Sep 17 00:00:00 2001 From: zyj Date: Wed, 4 Mar 2026 17:45:33 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E8=8E=B7=E5=8F=96=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E6=96=87=E4=BB=B6=E8=B7=AF=E5=BE=84=E5=87=BD=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/config/paths.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/internal/config/paths.go b/internal/config/paths.go index 2fbbcfa..f5b39af 100644 --- a/internal/config/paths.go +++ b/internal/config/paths.go @@ -3,6 +3,8 @@ package config import ( "os" "path/filepath" + + "github.com/spf13/viper" ) const ( @@ -55,3 +57,11 @@ func (p *Paths) EnsureDirs() error { } return nil } + +func (p *Paths) ConfigFilePath() string { + path := viper.ConfigFileUsed() // 触发 viper 加载配置文件 + if path != "" { + return path + } + return p.Config +}