fix: 解决 zip 压缩在某些情况下失败的问题 (#2809)

This commit is contained in:
zhengkunwang 2023-11-05 21:43:32 +08:00 committed by GitHub
parent 9d1757dba6
commit cd5658adab
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 1 deletions

View file

@ -304,6 +304,14 @@ func (f FileOp) Cut(oldPaths []string, dst, name string, cover bool) error {
return nil
}
func (f FileOp) Mv(oldPath, dstPath string) error {
cmdStr := fmt.Sprintf("mv %s %s", oldPath, dstPath)
if err := cmd.ExecCmd(cmdStr); err != nil {
return err
}
return nil
}
func (f FileOp) Copy(src, dst string) error {
if src = path.Clean("/" + src); src == "" {
return os.ErrNotExist

View file

@ -39,5 +39,5 @@ func (z ZipArchiver) Compress(sourcePaths []string, dstFile string) error {
if err := cmd.ExecCmdWithDir(cmdStr, baseDir); err != nil {
return err
}
return op.Rename(tmpFile, dstFile)
return op.Mv(tmpFile, dstFile)
}