core: drop dead/unused code
The daemon is a nice idea but needs a lot more thought. Let's just delete the unused code for now and come back to it later.
This commit is contained in:
1 parent
311493338e
commit
664e9b404d
3 files changed
-261
No files matched your search
@@ -394,90 +394,3 @@ ot_gio_checksum_stream_finish (GInputStream *in,
|
||||
return g_memdup (g_simple_async_result_get_op_res_gpointer (simple), 32);
|
||||
|
||||
}
|
||||
|
||||
gboolean
|
||||
ot_gfile_merge_dirs (GFile *destination,
|
||||
GFile *src,
|
||||
GCancellable *cancellable,
|
||||
GError **error)
|
||||
{
|
||||
gboolean ret = FALSE;
|
||||
const char *dest_path = NULL;
|
||||
const char *src_path = NULL;
|
||||
GError *temp_error = NULL;
|
||||
const char *name;
|
||||
guint32 type;
|
||||
const int move_flags = G_FILE_COPY_OVERWRITE | G_FILE_COPY_NOFOLLOW_SYMLINKS | G_FILE_COPY_ALL_METADATA;
|
||||
ot_lobj GFileInfo *src_fileinfo = NULL;
|
||||
ot_lobj GFileInfo *dest_fileinfo = NULL;
|
||||
ot_lobj GFileEnumerator *src_enum = NULL;
|
||||
ot_lobj GFile *dest_subfile = NULL;
|
||||
ot_lobj GFile *src_subfile = NULL;
|
||||
|
||||
dest_path = ot_gfile_get_path_cached (destination);
|
||||
src_path = ot_gfile_get_path_cached (src);
|
||||
|
||||
dest_fileinfo = g_file_query_info (destination, OSTREE_GIO_FAST_QUERYINFO,
|
||||
G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
|
||||
cancellable, &temp_error);
|
||||
if (dest_fileinfo)
|
||||
{
|
||||
type = g_file_info_get_attribute_uint32 (dest_fileinfo, "standard::type");
|
||||
if (type != G_FILE_TYPE_DIRECTORY)
|
||||
{
|
||||
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
|
||||
"Attempting to replace non-directory %s with directory %s",
|
||||
dest_path, src_path);
|
||||
goto out;
|
||||
}
|
||||
|
||||
src_enum = g_file_enumerate_children (src, OSTREE_GIO_FAST_QUERYINFO,
|
||||
G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
|
||||
cancellable, error);
|
||||
if (!src_enum)
|
||||
goto out;
|
||||
|
||||
while ((src_fileinfo = g_file_enumerator_next_file (src_enum, cancellable, &temp_error)) != NULL)
|
||||
{
|
||||
type = g_file_info_get_attribute_uint32 (src_fileinfo, "standard::type");
|
||||
name = g_file_info_get_attribute_byte_string (src_fileinfo, "standard::name");
|
||||
|
||||
dest_subfile = g_file_get_child (destination, name);
|
||||
src_subfile = g_file_get_child (src, name);
|
||||
|
||||
if (type == G_FILE_TYPE_DIRECTORY)
|
||||
{
|
||||
if (!ot_gfile_merge_dirs (dest_subfile, src_subfile, cancellable, error))
|
||||
goto out;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!g_file_move (src_subfile, dest_subfile,
|
||||
move_flags, NULL, NULL, cancellable, error))
|
||||
goto out;
|
||||
}
|
||||
|
||||
g_clear_object (&dest_subfile);
|
||||
g_clear_object (&src_subfile);
|
||||
}
|
||||
if (temp_error)
|
||||
{
|
||||
g_propagate_error (error, temp_error);
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
else if (g_error_matches (temp_error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND))
|
||||
{
|
||||
g_clear_error (&temp_error);
|
||||
if (!g_file_move (src, destination, move_flags, NULL, NULL, cancellable, error))
|
||||
goto out;
|
||||
}
|
||||
else
|
||||
goto out;
|
||||
|
||||
(void) rmdir (ot_gfile_get_path_cached (src));
|
||||
|
||||
ret = TRUE;
|
||||
out:
|
||||
return ret;
|
||||
}
|
||||
@@ -96,11 +96,6 @@ guchar * ot_gio_checksum_stream_finish (GInputStream *in,
|
||||
GAsyncResult *result,
|
||||
GError **error);
|
||||
|
||||
gboolean ot_gfile_merge_dirs (GFile *destination,
|
||||
GFile *src,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif
|
||||
Reference in new issue
Block a user