Commit 5588effa authored by Andreas Henriksson's avatar Andreas Henriksson Committed by Paolo Bacchilega
Browse files

Handle relative paths in cmdline arguments better

File-roller didn't take into account that the
working directory might have changed between
opening the first instance and opening additional
archives on the command line with relative paths.

When a relative path was used for an archive
on the command line, it would always be relative
to the first instance working directory - not to
the launched instance working directory.

This is fixed by using the recently added
g_application_command_line_create_file_for_arg ()
(in gio since 2.36).

Problem reported by John Stumpo <>
parent b47d2cd3
......@@ -20,7 +20,7 @@ AC_PATH_PROG(GLIB_MKENUMS, glib-mkenums)
AC_PATH_PROG(GLIB_COMPILE_RESOURCES, glib-compile-resources)
......@@ -656,13 +656,13 @@ fr_application_command_line (GApplication *application,
if (arg_extract_to != NULL)
extraction_destination = g_file_new_for_commandline_arg (arg_extract_to);
extraction_destination = g_application_command_line_create_file_for_arg (command_line, arg_extract_to);
if (arg_add_to != NULL)
add_to_archive = g_file_new_for_commandline_arg (arg_add_to);
add_to_archive = g_application_command_line_create_file_for_arg (command_line, arg_add_to);
if (arg_default_dir != NULL)
default_directory = g_file_new_for_commandline_arg (arg_default_dir);
default_directory = g_application_command_line_create_file_for_arg (command_line, arg_default_dir);
if ((arg_add_to != NULL) || (arg_add == 1)) { /* Add files to an archive */
GtkWidget *window;
......@@ -677,7 +677,7 @@ fr_application_command_line (GApplication *application,
file_list = NULL;
while ((filename = remaining_args[i++]) != NULL)
file_list = g_list_prepend (file_list, g_file_new_for_commandline_arg (filename));
file_list = g_list_prepend (file_list, g_application_command_line_create_file_for_arg (command_line, filename));
file_list = g_list_reverse (file_list);
fr_window_new_batch (FR_WINDOW (window), _("Compress"));
......@@ -708,7 +708,7 @@ fr_application_command_line (GApplication *application,
while ((archive = remaining_args[i++]) != NULL) {
GFile *file;
file = g_file_new_for_commandline_arg (archive);
file = g_application_command_line_create_file_for_arg (command_line, archive);
if (arg_extract_here == 1)
fr_window_set_batch__extract_here (FR_WINDOW (window), file);
......@@ -734,7 +734,7 @@ fr_application_command_line (GApplication *application,
window = fr_window_new ();
gtk_widget_show (window);
file = g_file_new_for_commandline_arg (filename);
file = g_application_command_line_create_file_for_arg (command_line, filename);
fr_window_archive_open (FR_WINDOW (window), file, GTK_WINDOW (window));
g_object_unref (file);
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