1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
|
diff --git a/backend/comics/comics-document.c b/backend/comics/comics-document.c
index a135a74..380cb54 100644
--- a/backend/comics/comics-document.c
+++ b/backend/comics/comics-document.c
@@ -54,8 +54,7 @@
typedef enum
{
- RARLABS,
- GNAUNRAR,
+ LIBARCHIVE,
UNZIP,
P7ZIP,
TAR
@@ -107,11 +106,8 @@ typedef struct {
} ComicBookDecompressCommand;
static const ComicBookDecompressCommand command_usage_def[] = {
- /* RARLABS unrar */
- {"%s p -c- -ierr --", "%s vb -c- -- %s", NULL , FALSE, NO_OFFSET},
-
- /* GNA! unrar */
- {NULL , "%s t %s" , "%s -xf %s %s" , FALSE, NO_OFFSET},
+ /* libarchive */
+ {NULL , "%s tf %s" , "%s xf %s %s" , FALSE, NO_OFFSET},
/* unzip */
{"%s -p -C --" , "%s %s" , NULL , TRUE , OFFSET_ZIP},
@@ -282,7 +278,7 @@ comics_generate_command_lines (ComicsDocument *comics_document,
if (comics_document->dir == NULL)
return FALSE;
- /* unrar-free can't create directories, but ev_mkdtemp already created the dir */
+ /* libarchive can't create directories on rar support, but ev_mkdtemp already created the dir */
comics_document->decompress_tmp =
g_strdup_printf (command_usage_def[type].decompress_tmp,
@@ -321,51 +317,10 @@ comics_check_decompress_command (gchar *mime_type,
if (!strcmp (mime_type, "application/x-cbr") ||
!strcmp (mime_type, "application/x-rar")) {
- /* The RARLAB provides a no-charge proprietary (freeware)
- * decompress-only client for Linux called unrar. Another
- * option is a GPLv2-licensed command-line tool developed by
- * the Gna! project. Confusingly enough, the free software RAR
- * decoder is also named unrar. For this reason we need to add
- * some lines for disambiguation. Sorry for the added the
- * complexity but it's life :)
- * Finally, some distributions, like Debian, rename this free
- * option as unrar-free.
- * */
- comics_document->selected_command =
- g_find_program_in_path ("unrar");
- if (comics_document->selected_command) {
- /* We only use std_err to avoid printing useless error
- * messages on the terminal */
- success =
- g_spawn_command_line_sync (
- comics_document->selected_command,
- &std_out, &std_err,
- &retval, &err);
- if (!success) {
- g_propagate_error (error, err);
- g_error_free (err);
- return FALSE;
- /* I don't check retval status because RARLAB unrar
- * doesn't have a way to return 0 without involving an
- * operation with a file*/
- } else if (WIFEXITED (retval)) {
- if (g_strrstr (std_out,"freeware") != NULL)
- /* The RARLAB freeware client */
- comics_document->command_usage = RARLABS;
- else
- /* The Gna! free software client */
- comics_document->command_usage = GNAUNRAR;
-
- g_free (std_out);
- g_free (std_err);
- return TRUE;
- }
- }
- /* The Gna! free software client with Debian naming convention */
comics_document->selected_command =
- g_find_program_in_path ("unrar-free");
+ g_find_program_in_path ("bsdtar");
if (comics_document->selected_command) {
- comics_document->command_usage = GNAUNRAR;
+ comics_document->command_usage = LIBARCHIVE;
return TRUE;
}
|