41 lines
1.6 KiB
Diff
41 lines
1.6 KiB
Diff
|
diff --git a/src/fr-archive-libarchive.c b/src/fr-archive-libarchive.c
|
||
|
index 9a11e45..83b9ade 100644
|
||
|
--- a/src/fr-archive-libarchive.c
|
||
|
+++ b/src/fr-archive-libarchive.c
|
||
|
@@ -582,7 +582,7 @@ extract_archive_thread (GSimpleAsyncResult *result,
|
||
|
const char *relative_path;
|
||
|
GFile *file;
|
||
|
GFile *parent;
|
||
|
- GOutputStream *ostream;
|
||
|
+ struct archive *ext;
|
||
|
const void *buffer;
|
||
|
size_t buffer_size;
|
||
|
int64_t offset;
|
||
|
@@ -777,16 +777,21 @@ extract_archive_thread (GSimpleAsyncResult *result,
|
||
|
break;
|
||
|
|
||
|
case AE_IFREG:
|
||
|
- ostream = (GOutputStream *) g_file_replace (file, NULL, FALSE, G_FILE_CREATE_REPLACE_DESTINATION, cancellable, &load_data->error);
|
||
|
- if (ostream == NULL)
|
||
|
+ ext = archive_write_disk_new();
|
||
|
+ if (ext == NULL)
|
||
|
break;
|
||
|
+ archive_write_disk_set_options(ext, ARCHIVE_EXTRACT_TIME|ARCHIVE_EXTRACT_PERM|ARCHIVE_EXTRACT_ACL|ARCHIVE_EXTRACT_FFLAGS);
|
||
|
+ archive_write_disk_set_standard_lookup(ext);
|
||
|
+ archive_entry_set_pathname(entry, g_file_get_path(file));
|
||
|
+ archive_write_header(ext, entry);
|
||
|
|
||
|
while ((r = archive_read_data_block (a, &buffer, &buffer_size, &offset)) == ARCHIVE_OK) {
|
||
|
- if (g_output_stream_write (ostream, buffer, buffer_size, cancellable, &load_data->error) == -1)
|
||
|
+ if ((r = archive_write_data_block(ext, buffer, buffer_size, offset)) < ARCHIVE_OK)
|
||
|
break;
|
||
|
fr_archive_progress_inc_completed_bytes (load_data->archive, buffer_size);
|
||
|
}
|
||
|
- _g_object_unref (ostream);
|
||
|
+ archive_write_close(ext);
|
||
|
+ archive_write_free (ext);
|
||
|
|
||
|
if (r != ARCHIVE_EOF)
|
||
|
load_data->error = _g_error_new_from_archive_error (archive_error_string (a));
|
||
|
|