From 9a6adcc665700eb833066ef9728d97ff9ad6b0b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=80=97=E5=AD=90?= Date: Thu, 10 Oct 2024 21:10:21 +0800 Subject: [PATCH] fix: isAir and isDirectlyRun in Windows --- foundation/path.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/foundation/path.go b/foundation/path.go index 735922e90..a77fd46e8 100644 --- a/foundation/path.go +++ b/foundation/path.go @@ -35,7 +35,7 @@ func isTesting() bool { // isAir checks if the application is running using Air. func isAir() bool { for _, arg := range os.Args { - if strings.Contains(arg, "/storage/temp") { + if strings.Contains(filepath.ToSlash(arg), "/storage/temp") { return true } } @@ -47,5 +47,5 @@ func isAir() bool { func isDirectlyRun() bool { executable, _ := os.Executable() return strings.Contains(filepath.Base(executable), os.TempDir()) || - (strings.Contains(executable, "/var/folders") && strings.Contains(executable, "/T/go-build")) // macOS + (strings.Contains(filepath.ToSlash(executable), "/var/folders") && strings.Contains(filepath.ToSlash(executable), "/T/go-build")) // macOS }