Ignore certain files from archive

main
Jef Roosens 2022-01-13 23:28:18 +01:00
parent d4b7a25c06
commit 0ed2c9f854
Signed by untrusted user: Jef Roosens
GPG Key ID: 955C0660072F691F
2 changed files with 6 additions and 3 deletions

View File

@ -31,8 +31,11 @@ pub fn pkg_info(pkg_path string) ?(string, []string) {
for C.archive_read_next_header(a, &entry) == C.ARCHIVE_OK { for C.archive_read_next_header(a, &entry) == C.ARCHIVE_OK {
pathname := C.archive_entry_pathname(entry) pathname := C.archive_entry_pathname(entry)
unsafe { ignored_names := [c'.BUILDINFO', c'.INSTALL', c'.MTREE', c'.PKGINFO', c'.CHANGELOG']
files << cstring_to_vstring(pathname) if ignored_names.all(C.strcmp(it, pathname) != 0) {
unsafe {
files << cstring_to_vstring(pathname)
}
} }
if C.strcmp(pathname, c'.PKGINFO') == 0 { if C.strcmp(pathname, c'.PKGINFO') == 0 {

View File

@ -105,7 +105,7 @@ fn reader_to_file(mut reader io.BufferedReader, length int, path string) ? {
fn main() { fn main() {
// archive.list_filenames() // archive.list_filenames()
res := pkg.read_pkg('test/jjr-joplin-desktop-2.6.10-4-x86_64.pkg.tar.zst') or { res := pkg.read_pkg('test/homebank-5.5.1-1-x86_64.pkg.tar.zst') or {
eprintln(err.msg) eprintln(err.msg)
return return
} }