Lines Matching refs:archive

34 #define compress (archive->type == XARCHIVETYPE_COMPRESS)
35 #define lrzip (archive->type == XARCHIVETYPE_LRZIP)
36 #define lz4 (archive->type == XARCHIVETYPE_LZ4)
37 #define xz (archive->type == XARCHIVETYPE_XZ)
38 #define zstd (archive->type == XARCHIVETYPE_ZSTD)
106 gchar *xa_gzip_et_al_get_command (const gchar *program, gchar *workfile, gchar *archive, const gcha… in xa_gzip_et_al_get_command() argument
112 archive = xa_quote_shell_command(archive, TRUE); in xa_gzip_et_al_get_command()
113 …" -c ", workfile, password_str, type == XARCHIVETYPE_LRZIP ? " -fo " : " > ", archive, "\"", NULL); in xa_gzip_et_al_get_command()
114 g_free(archive); in xa_gzip_et_al_get_command()
121 static void xa_gzip_et_al_can (XArchive *archive, gboolean can) in xa_gzip_et_al_can() argument
123 archive->can_test = (can && !compress && (!zstd || zstd_can_test)); in xa_gzip_et_al_can()
124 archive->can_extract = can; in xa_gzip_et_al_can()
125 archive->can_password = (can && lrzip && lrzip_can_password); in xa_gzip_et_al_can()
126 archive->can_overwrite = can; in xa_gzip_et_al_can()
127 archive->can_move = can; in xa_gzip_et_al_can()
130 archive->can_add = (can && archiver[archive->type].is_compressor); in xa_gzip_et_al_can()
133 void xa_gzip_et_al_ask (XArchive *archive) in xa_gzip_et_al_ask() argument
135 xa_gzip_et_al_can(archive, TRUE); in xa_gzip_et_al_ask()
138 static void xa_gzip_et_al_parse_output (gchar *line, XArchive *archive) in xa_gzip_et_al_parse_output() argument
146 if (archive->type == XARCHIVETYPE_GZIP) in xa_gzip_et_al_parse_output()
152 else if (archive->type == XARCHIVETYPE_LZIP) in xa_gzip_et_al_parse_output()
163 else if (archive->type == XARCHIVETYPE_LZOP) in xa_gzip_et_al_parse_output()
172 else if (archive->type == XARCHIVETYPE_XZ) in xa_gzip_et_al_parse_output()
214 if (archive->type == XARCHIVETYPE_XZ) in xa_gzip_et_al_parse_output()
233 if ((archive->type == XARCHIVETYPE_LZIP) && g_str_has_suffix(filename, ".lz")) in xa_gzip_et_al_parse_output()
239 entry = xa_set_archive_entries_for_each_row(archive, filename, item); in xa_gzip_et_al_parse_output()
243 archive->files = 1; in xa_gzip_et_al_parse_output()
244 archive->files_size = g_ascii_strtoull(item[0], NULL, 0); in xa_gzip_et_al_parse_output()
253 static void xa_gzip_et_al_parse_lrzip (gchar *line, XArchive *archive) in xa_gzip_et_al_parse_lrzip() argument
298 entry = xa_set_archive_entries_for_each_row(archive, filename, item); in xa_gzip_et_al_parse_lrzip()
302 entry->is_encrypted = archive->has_password; in xa_gzip_et_al_parse_lrzip()
304 archive->files = 1; in xa_gzip_et_al_parse_lrzip()
305 archive->files_size = g_ascii_strtoull(item[0], NULL, 0); in xa_gzip_et_al_parse_lrzip()
318 static void xa_gzip_et_al_parse_zstd (gchar *line, XArchive *archive) in xa_gzip_et_al_parse_zstd() argument
379 entry = xa_set_archive_entries_for_each_row(archive, filename, item); in xa_gzip_et_al_parse_zstd()
383 archive->files = 1; in xa_gzip_et_al_parse_zstd()
384 archive->files_size = g_ascii_strtoull(item[0], NULL, 0); in xa_gzip_et_al_parse_zstd()
397 static void xa_gzip_et_al_globally_stored_entry (gchar *line, XArchive *archive) in xa_gzip_et_al_globally_stored_entry() argument
403 filename = g_path_get_basename(archive->path[0]); in xa_gzip_et_al_globally_stored_entry()
409 entry = xa_set_archive_entries_for_each_row(archive, filename, item); in xa_gzip_et_al_globally_stored_entry()
413 entry->is_encrypted = archive->has_password; in xa_gzip_et_al_globally_stored_entry()
415 archive->files = 1; in xa_gzip_et_al_globally_stored_entry()
426 void xa_gzip_et_al_list (XArchive *archive) in xa_gzip_et_al_list() argument
436 if (archive->type == XARCHIVETYPE_LRZIP) in xa_gzip_et_al_list()
438 file = fopen(archive->path[0], "r"); in xa_gzip_et_al_list()
447 archive->has_password = TRUE; in xa_gzip_et_al_list()
452 if (archive->has_password && !lrzip_can_password) in xa_gzip_et_al_list()
455 xa_run_command(archive, command); in xa_gzip_et_al_list()
461 if (archive->has_password) in xa_gzip_et_al_list()
462 if (!xa_check_password(archive)) in xa_gzip_et_al_list()
465 if (!xa_create_working_directory(archive)) in xa_gzip_et_al_list()
468 password_str = xa_gzip_et_al_password_str(archive->password, archive->type); in xa_gzip_et_al_list()
469 archive_path = xa_quote_shell_command(archive->path[0], TRUE); in xa_gzip_et_al_list()
471 archive->child_dir = g_strdup(archive->working_dir); in xa_gzip_et_al_list()
472 …command = g_strconcat("sh -c \"", archiver[archive->type].program[0], lrzip ? " " : " -c ", "-d", … in xa_gzip_et_al_list()
473 xa_run_command(archive, command); in xa_gzip_et_al_list()
476 g_free(archive->child_dir); in xa_gzip_et_al_list()
477 archive->child_dir = NULL; in xa_gzip_et_al_list()
482 workfile = g_strconcat(archive->working_dir, "/", decompfile, NULL); in xa_gzip_et_al_list()
497 if (!xa_get_compressed_tar_type(&archive->type)) in xa_gzip_et_al_list()
500 archive->path[2] = g_shell_quote(workfile); in xa_gzip_et_al_list()
503 xa_gzip_et_al_can(archive, FALSE); in xa_gzip_et_al_list()
505 archive->archiver = &archiver[XARCHIVETYPE_TAR]; in xa_gzip_et_al_list()
507 (*archive->archiver->ask)(archive); in xa_gzip_et_al_list()
508 (*archive->archiver->list)(archive); in xa_gzip_et_al_list()
516 archive->can_add = FALSE; in xa_gzip_et_al_list()
518 stat(archive->path[0], &st); in xa_gzip_et_al_list()
528 archive->columns = 8; in xa_gzip_et_al_list()
529 archive->parse_output = NULL; in xa_gzip_et_al_list()
531 switch (archive->type) in xa_gzip_et_al_list()
540 if (archive->type == XARCHIVETYPE_LRZIP) in xa_gzip_et_al_list()
542 if (archive->has_password) in xa_gzip_et_al_list()
556 archive->columns = 10; in xa_gzip_et_al_list()
558 else if (archive->type == XARCHIVETYPE_LZOP) in xa_gzip_et_al_list()
565 archive->columns = 9; in xa_gzip_et_al_list()
567 else if (archive->type == XARCHIVETYPE_XZ) in xa_gzip_et_al_list()
576 archive->columns = 10; in xa_gzip_et_al_list()
578 else if (archive->type == XARCHIVETYPE_ZSTD) in xa_gzip_et_al_list()
597 archive->columns = 10; in xa_gzip_et_al_list()
600 …mand = g_strconcat(archiver[archive->type].program[0], lrzip ? " -i" : " -l", xz ? " --robot " : (… in xa_gzip_et_al_list()
602 if (archive->type == XARCHIVETYPE_LRZIP) in xa_gzip_et_al_list()
603 archive->parse_output = xa_gzip_et_al_parse_lrzip; in xa_gzip_et_al_list()
604 else if (archive->type == XARCHIVETYPE_ZSTD) in xa_gzip_et_al_list()
605 archive->parse_output = xa_gzip_et_al_parse_zstd; in xa_gzip_et_al_list()
607 archive->parse_output = xa_gzip_et_al_parse_output; in xa_gzip_et_al_list()
621 if (!archive->parse_output) in xa_gzip_et_al_list()
631 archive->files_size = (guint64) st.st_size; in xa_gzip_et_al_list()
632 item[0] = g_strdup_printf("%" G_GUINT64_FORMAT, archive->files_size); in xa_gzip_et_al_list()
642 archive->parse_output = xa_gzip_et_al_globally_stored_entry; in xa_gzip_et_al_list()
647 xa_spawn_async_process(archive, command); in xa_gzip_et_al_list()
650 archive->size_column = 2; in xa_gzip_et_al_list()
651 archive->column_types = g_malloc0(sizeof(types)); in xa_gzip_et_al_list()
653 for (i = 0; i < archive->columns; i++) in xa_gzip_et_al_list()
654 archive->column_types[i] = types[i]; in xa_gzip_et_al_list()
656 xa_create_liststore(archive, titles); in xa_gzip_et_al_list()
659 void xa_gzip_et_al_test (XArchive *archive) in xa_gzip_et_al_test() argument
663 password_str = xa_gzip_et_al_password_str(archive->password, archive->type); in xa_gzip_et_al_test()
664 …command = g_strconcat(archiver[archive->type].program[0], " -t", password_str, lrzip || lz4 ? " " … in xa_gzip_et_al_test()
667 xa_run_command(archive, command); in xa_gzip_et_al_test()
671 gboolean xa_gzip_et_al_extract (XArchive *archive, GSList *file_list) in xa_gzip_et_al_extract() argument
688 filename = g_path_get_basename(archive->path[0]); in xa_gzip_et_al_extract()
697 out_dir = g_shell_unquote(archive->extraction_dir, NULL); in xa_gzip_et_al_extract()
700 archive_path = xa_quote_shell_command(archive->path[0], TRUE); in xa_gzip_et_al_extract()
701 extraction_dir = xa_quote_shell_command(archive->extraction_dir, FALSE); in xa_gzip_et_al_extract()
703 if (archive->do_overwrite || !g_file_test(out_file, G_FILE_TEST_EXISTS)) in xa_gzip_et_al_extract()
705 password_str = xa_gzip_et_al_password_str(archive->password, archive->type); in xa_gzip_et_al_extract()
706 …command = g_strconcat("sh -c \"", archiver[archive->type].program[0], lrzip ? " " : " -c ", "-d", … in xa_gzip_et_al_extract()
720 result = xa_run_command(archive, command); in xa_gzip_et_al_extract()
726 void xa_gzip_et_al_add (XArchive *archive, GSList *file_list, gchar *compression) in xa_gzip_et_al_add() argument
731 if (archive->location_path != NULL) in xa_gzip_et_al_add()
732 archive->child_dir = g_strdup(archive->working_dir); in xa_gzip_et_al_add()
736 switch (archive->type) in xa_gzip_et_al_add()
773 archive_path = xa_quote_shell_command(archive->path[0], TRUE); in xa_gzip_et_al_add()
775 if (archive->do_move) in xa_gzip_et_al_add()
780 password_str = xa_gzip_et_al_password_str(archive->password, archive->type); in xa_gzip_et_al_add()
781 …command = g_strconcat("sh -c \"", archiver[archive->type].program[0], lrzip ? " -" : " -c -", comp… in xa_gzip_et_al_add()
789 xa_run_command(archive, command); in xa_gzip_et_al_add()