Closed DylanZhu2021 closed 3 months ago
The order of directory structure in a rar file is reversed for other types of files, such as 7z.
this is code:
handler := func(ctx context.Context, f archiver.File) error { if f.IsDir() { err := fileSystem.MkdirAll(ctx, filepath.Join(dst, f.Name()), f.Mode()) if err != nil { return err } fileSystem.Chown(ctx, filepath.Join(dst, f.Name()), utils.UserID(userName), utils.GroupID(userName)) } else { destFile, err := fileSystem.Create(ctx, vfs.PathFileObj(filepath.Join(dst, f.NameInArchive))) if err != nil { return err } defer destFile.Close() srcFile, err := f.Open() if err != nil { return err } _, err = io.Copy(destFile, srcFile) if err != nil { return err } } return nil } err = rar.Extract(ctx, input, nil, handler)
The order of directory structure in a rar file is reversed for other types of files, such as 7z.
this is code: