summaryrefslogtreecommitdiff
path: root/libre/gloobus-preview-libre/gloobus-preview-usr-bsdtar-for-rar.patch
blob: f5b7c8e00e07d964c81cf8b8de1955494fe9922c (plain)
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
------------------------------------------------------------
revno: 291
committer: Michał Masłowski <mtjm@mtjm.eu>
branch nick: gloobus-preview
timestamp: Sun 2013-06-23 14:43:35 +0200
message:
  Use bsdtar to open RAR archives if unrar is not available.
  
  Needs bsdtar from libarchive 3.0 or newer, not tested with older
  versions nor checking for them.
diff:
=== modified file 'src/plugin-compressed/plugin-compressed.cpp'
--- src/plugin-compressed/plugin-compressed.cpp	2012-04-06 11:25:47 +0000
+++ src/plugin-compressed/plugin-compressed.cpp	2013-06-23 12:43:35 +0000
@@ -52,8 +52,9 @@
 		cmd_args.push_back("--");
 		line_parser = &iCompressed::parse_line_7z;
 	}
-	else if ( type == GP_COMPRESSED_RAR
-			|| type == GP_COMPRESSED_RAR_X )
+	else if ( (type == GP_COMPRESSED_RAR
+				|| type == GP_COMPRESSED_RAR_X)
+			&& interface::is_program_available("unrar") )
 	{
 		cmd_args.push_back("unrar");
 		cmd_args.push_back("vb");
@@ -70,9 +71,15 @@
 			|| type == GP_COMPRESSED_TAR_LZOP
 			|| type == GP_COMPRESSED_TAR_X
 			|| type == GP_COMPRESSED_TAR_XZ
-			|| type == GP_COMPRESSED_TAR_Z )
+			|| type == GP_COMPRESSED_TAR_Z
+			|| type == GP_COMPRESSED_RAR
+			|| type == GP_COMPRESSED_RAR_X )
 	{
-		cmd_args.push_back("tar");
+		if ( type == GP_COMPRESSED_RAR
+	       		|| type == GP_COMPRESSED_RAR_X )
+			cmd_args.push_back("bsdtar");
+		else
+			cmd_args.push_back("tar");
 		cmd_args.push_back("-tf");
 		line_parser = &iCompressed::parse_line_rar;
 	}

=== modified file 'src/plugin-compressed/plugin-compressed.h'
--- src/plugin-compressed/plugin-compressed.h	2010-03-27 15:55:08 +0000
+++ src/plugin-compressed/plugin-compressed.h	2013-06-23 12:43:35 +0000
@@ -102,7 +102,7 @@
 	PluginManager::register_filetype(GP_COMPRESSED_7Z, 1);
 }
 
-if(interface::is_program_available("unrar")) {
+if(interface::is_program_available("unrar") || interface::is_program_available("bsdtar")) {
 	PluginManager::register_filetype(GP_COMPRESSED_RAR, 1);
 	PluginManager::register_filetype(GP_COMPRESSED_RAR_X, 1);
 }