From e1818849db030337edc18834bb2d86b472fb2e2b Mon Sep 17 00:00:00 2001 From: unknown-o Date: Tue, 9 Dec 2025 08:55:03 +0000 Subject: [PATCH] =?UTF-8?q?mod:=20=E5=BC=80=E5=8F=91=E6=A8=A1=E5=BC=8F?= =?UTF-8?q?=E4=B8=8B=E4=BD=BF=E7=94=A8=E5=B7=A5=E4=BD=9C=E7=9B=AE=E5=BD=95?= =?UTF-8?q?=E4=BD=9C=E4=B8=BA=E6=95=B0=E6=8D=AE=E5=BA=93=E7=9B=AE=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/migrations/init.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/backend/migrations/init.go b/backend/migrations/init.go index d218253..03dbffd 100644 --- a/backend/migrations/init.go +++ b/backend/migrations/init.go @@ -5,14 +5,21 @@ import ( "ALLinSSL/backend/public/sqlite_migrate" "database/sql" "fmt" - _ "modernc.org/sqlite" "os" "path/filepath" + "strings" + + _ "modernc.org/sqlite" ) func init() { // 指定运行目录为当前目录 exePath, err := os.Executable() + + // 如果为开发环境则使用工作目录 + if strings.Contains(exePath, "go-build") { + exePath, _ = os.Getwd() + } if err != nil { fmt.Fprintf(os.Stderr, "获取可执行文件路径失败: %v\n", err) os.Exit(1)