From 12338e0ac193eec8ab17746ba2e9b91828dcf0f1 Mon Sep 17 00:00:00 2001 From: zongz Date: Wed, 5 Jun 2024 18:37:00 +0800 Subject: [PATCH] fix: fix test case Signed-off-by: zongz --- pkg/client/client.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pkg/client/client.go b/pkg/client/client.go index 2c818ae6..8728117d 100644 --- a/pkg/client/client.go +++ b/pkg/client/client.go @@ -1001,6 +1001,12 @@ func (c *KpmClient) Download(dep *pkg.Dependency, homePath, localPath string) (* } // rename the tmp dir to the local path. + if utils.DirExists(localPath) { + err := os.RemoveAll(localPath) + if err != nil { + return nil, err + } + } err = os.Rename(tmpDir, localPath) if err != nil { return nil, err