From 1e80f0e6536eaaadf4cfc7cc0392212f2fdef751 Mon Sep 17 00:00:00 2001 From: zongz Date: Thu, 6 Jun 2024 10:38:27 +0800 Subject: [PATCH] fix: fix windows test case Signed-off-by: zongz --- pkg/client/client.go | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/pkg/client/client.go b/pkg/client/client.go index 8728117d..ef192745 100644 --- a/pkg/client/client.go +++ b/pkg/client/client.go @@ -6,6 +6,7 @@ import ( "io" "os" "path/filepath" + "runtime" "strings" "github.com/BurntSushi/toml" @@ -1007,9 +1008,17 @@ func (c *KpmClient) Download(dep *pkg.Dependency, homePath, localPath string) (* return nil, err } } - err = os.Rename(tmpDir, localPath) - if err != nil { - return nil, err + + if runtime.GOOS != "windows" { + err = os.Rename(tmpDir, localPath) + if err != nil { + return nil, err + } + } else { + err = copy.Copy(tmpDir, localPath) + if err != nil { + return nil, err + } } // load the package from the local path.