libarchive-ruby-swig 0.5.4 → 0.5.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -22,9 +22,8 @@
|
|
22
22
|
#include "error.h"
|
23
23
|
|
24
24
|
Entry::Entry(struct archive_entry *entry)
|
25
|
-
|
26
|
-
|
27
|
-
}
|
25
|
+
: _entry(entry)
|
26
|
+
{}
|
28
27
|
|
29
28
|
Entry::~Entry()
|
30
29
|
{
|
@@ -36,7 +35,12 @@ Entry::~Entry()
|
|
36
35
|
|
37
36
|
bool Entry::is_file()
|
38
37
|
{
|
39
|
-
|
38
|
+
if(S_ISREG(archive_entry_filetype(_entry)) &&
|
39
|
+
!this->is_hardlink()) {
|
40
|
+
return true;
|
41
|
+
}
|
42
|
+
|
43
|
+
return false;
|
40
44
|
}
|
41
45
|
|
42
46
|
bool Entry::is_directory()
|
@@ -69,6 +73,14 @@ bool Entry::is_socket()
|
|
69
73
|
return S_ISSOCK(archive_entry_filetype(_entry));
|
70
74
|
}
|
71
75
|
|
76
|
+
bool Entry::is_hardlink()
|
77
|
+
{
|
78
|
+
if(archive_entry_hardlink(_entry) != 0)
|
79
|
+
return true;
|
80
|
+
|
81
|
+
return false;
|
82
|
+
}
|
83
|
+
|
72
84
|
unsigned int Entry::filetype()
|
73
85
|
{
|
74
86
|
return archive_entry_filetype(_entry);
|
@@ -122,6 +122,16 @@ Entry *Writer::new_entry_helper()
|
|
122
122
|
|
123
123
|
void Writer::write_header(Entry *entry)
|
124
124
|
{
|
125
|
+
if(entry->nlink() > 1) {
|
126
|
+
std::string path = _hardlinks[entry->dev()][entry->ino()];
|
127
|
+
if(path.empty()) {
|
128
|
+
_hardlinks[entry->dev()][entry->ino()] =
|
129
|
+
std::string(entry->pathname());
|
130
|
+
} else {
|
131
|
+
entry->set_hardlink(path.c_str());
|
132
|
+
}
|
133
|
+
}
|
134
|
+
|
125
135
|
if(archive_write_header(_ar, entry->_entry) != ARCHIVE_OK) {
|
126
136
|
std::string error_msg = archive_error_string(_ar);
|
127
137
|
throw Error(error_msg);
|
@@ -16,6 +16,8 @@ class Entry;
|
|
16
16
|
|
17
17
|
#ifndef SWIG
|
18
18
|
#include <ruby.h>
|
19
|
+
#include <string>
|
20
|
+
#include <map>
|
19
21
|
#endif
|
20
22
|
|
21
23
|
namespace Archive
|
@@ -101,6 +103,7 @@ class Writer
|
|
101
103
|
char *_buf;
|
102
104
|
int _buf_size;
|
103
105
|
|
106
|
+
std::map<unsigned long, std::map<unsigned long, std::string> > _hardlinks;
|
104
107
|
};
|
105
108
|
|
106
109
|
#endif
|
data/lib/libarchive_doc.rb
CHANGED
data/lib/libarchive_rs.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: libarchive-ruby-swig
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 7
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 5
|
9
|
-
-
|
10
|
-
version: 0.5.
|
9
|
+
- 6
|
10
|
+
version: 0.5.6
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Tobias Koch
|
@@ -15,11 +15,11 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-
|
18
|
+
date: 2011-04-16 00:00:00 +03:00
|
19
19
|
default_executable:
|
20
20
|
dependencies: []
|
21
21
|
|
22
|
-
description:
|
22
|
+
description: Ruby bindings to libarchive allowing reading and creation of compressed archives in a variety of formats.
|
23
23
|
email: tobias.koch@gmail.com
|
24
24
|
executables: []
|
25
25
|
|