mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-04-15 20:18:05 +02:00
Merge branch 'fix_3636' into 'main'
gio-tool: Fix handling of the trash original path Closes #3636 See merge request GNOME/glib!4556
This commit is contained in:
commit
7ea8543f7e
@ -92,7 +92,7 @@ restore_trash (GFile *file,
|
||||
GFile *target = NULL;
|
||||
GFile *dir_target = NULL;
|
||||
gboolean ret = FALSE;
|
||||
gchar *orig_path = NULL;
|
||||
const gchar *orig_path = NULL;
|
||||
GError *local_error = NULL;
|
||||
|
||||
info = g_file_query_info (file, G_FILE_ATTRIBUTE_TRASH_ORIG_PATH, G_FILE_QUERY_INFO_NONE, cancellable, &local_error);
|
||||
@ -102,7 +102,7 @@ restore_trash (GFile *file,
|
||||
goto exit_func;
|
||||
}
|
||||
|
||||
orig_path = g_file_info_get_attribute_as_string (info, G_FILE_ATTRIBUTE_TRASH_ORIG_PATH);
|
||||
orig_path = g_file_info_get_attribute_byte_string (info, G_FILE_ATTRIBUTE_TRASH_ORIG_PATH);
|
||||
if (!orig_path)
|
||||
{
|
||||
g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND, _("Unable to find original path"));
|
||||
@ -110,7 +110,6 @@ restore_trash (GFile *file,
|
||||
}
|
||||
|
||||
target = g_file_new_for_commandline_arg (orig_path);
|
||||
g_free (orig_path);
|
||||
|
||||
dir_target = g_file_get_parent (target);
|
||||
if (dir_target)
|
||||
@ -173,21 +172,23 @@ trash_list (GFile *file,
|
||||
while ((info = g_file_enumerator_next_file (enumerator, cancellable, &local_error)) != NULL)
|
||||
{
|
||||
const char *name;
|
||||
char *orig_path;
|
||||
const char *orig_path;
|
||||
char *uri;
|
||||
gchar *utf8_path;
|
||||
GFile* child;
|
||||
|
||||
name = g_file_info_get_name (info);
|
||||
child = g_file_get_child (file, name);
|
||||
uri = g_file_get_uri (child);
|
||||
g_object_unref (child);
|
||||
orig_path = g_file_info_get_attribute_as_string (info, G_FILE_ATTRIBUTE_TRASH_ORIG_PATH);
|
||||
orig_path = g_file_info_get_attribute_byte_string (info, G_FILE_ATTRIBUTE_TRASH_ORIG_PATH);
|
||||
utf8_path = g_filename_to_utf8 (orig_path, -1, NULL, NULL, NULL);
|
||||
|
||||
g_print ("%s\t%s\n", uri, orig_path);
|
||||
g_print ("%s\t%s\n", uri, utf8_path);
|
||||
|
||||
g_object_unref (info);
|
||||
g_free (orig_path);
|
||||
g_free (uri);
|
||||
g_free (utf8_path);
|
||||
}
|
||||
|
||||
if (local_error)
|
||||
|
Loading…
x
Reference in New Issue
Block a user