Commit 135053d5 authored by Ondrej Holy's avatar Ondrej Holy
Browse files

extractor: Fix extraction of one file archives

Currently, an empty folder is created when extracting an archive over
Nautilus which contains one file with the same name as the archive.
This is because gnome-autoar always creates the top-level folder, but
the one file archive with the same name should be extracted directly
without creating additional folders. Otherwise the `conflict` signal
is emitted and Nautilus by default skips conflicting files, so only
empty folder remains after extraction. This problem have not been
unfortunately noticed by the `test-one-file-same-name` unit test due to
differences in the `decide-destination` signal handling. Let's do not
create the top-level folder at all as `g_file_make_directory_with_parents`
is used later anyway.

Fixes: #28
parent e1c58e6d
......@@ -1832,28 +1832,11 @@ autoar_extractor_step_decide_destination (AutoarExtractor *self)
new_destination = (self->new_prefix != NULL) ? self->new_prefix : self->destination_dir;
destination_name = g_file_get_path (new_destination);
destination_name = g_file_get_path (self->new_prefix != NULL ?
self->new_prefix :
g_debug ("autoar_extractor_step_decide_destination: destination %s", destination_name);
g_file_make_directory_with_parents (new_destination,
if (g_error_matches (self->error, G_IO_ERROR, G_IO_ERROR_EXISTS)) {
GFileType file_type;
file_type = g_file_query_file_type (new_destination,
if (file_type == G_FILE_TYPE_DIRECTORY) {
/* FIXME: Implement a way to solve directory conflicts */
g_debug ("autoar_extractor_step_decide_destination: destination directory exists");
g_clear_error (&self->error);
g_list_free_full (files, g_object_unref);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment