lib: Delete old unused GFile helpers
This is all unused since the fd-relative/no-GFile porting. Delete delete delete! Closes: #767 Approved by: jlebon
This commit is contained in:
parent
8392faaffc
commit
8fea1937df
|
|
@ -66,130 +66,6 @@ ot_gfile_resolve_path_printf (GFile *path,
|
||||||
return g_file_resolve_relative_path (path, relpath);
|
return g_file_resolve_relative_path (path, relpath);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
gboolean
|
|
||||||
ot_gfile_get_symlink_target_from_info (GFile *path,
|
|
||||||
GFileInfo *file_info,
|
|
||||||
GFile **out_target,
|
|
||||||
GCancellable *cancellable,
|
|
||||||
GError **error)
|
|
||||||
{
|
|
||||||
gboolean ret = FALSE;
|
|
||||||
const char *target;
|
|
||||||
g_autoptr(GFile) path_parent = NULL;
|
|
||||||
g_autoptr(GFile) ret_target = NULL;
|
|
||||||
|
|
||||||
if (g_file_info_get_file_type (file_info) != G_FILE_TYPE_SYMBOLIC_LINK)
|
|
||||||
{
|
|
||||||
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
|
|
||||||
"Not a symbolic link");
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
|
|
||||||
path_parent = g_file_get_parent (path);
|
|
||||||
target = g_file_info_get_symlink_target (file_info);
|
|
||||||
g_assert (target);
|
|
||||||
ret_target = g_file_resolve_relative_path (path_parent, target);
|
|
||||||
|
|
||||||
ret = TRUE;
|
|
||||||
out:
|
|
||||||
ot_transfer_out_value (out_target, &ret_target);
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
gboolean
|
|
||||||
ot_gfile_query_info_allow_noent (GFile *path,
|
|
||||||
const char *queryopts,
|
|
||||||
GFileQueryInfoFlags flags,
|
|
||||||
GFileInfo **out_info,
|
|
||||||
GCancellable *cancellable,
|
|
||||||
GError **error)
|
|
||||||
{
|
|
||||||
gboolean ret = FALSE;
|
|
||||||
g_autoptr(GFileInfo) ret_file_info = NULL;
|
|
||||||
GError *temp_error = NULL;
|
|
||||||
|
|
||||||
ret_file_info = g_file_query_info (path, queryopts, flags,
|
|
||||||
cancellable, &temp_error);
|
|
||||||
if (!ret_file_info)
|
|
||||||
{
|
|
||||||
if (g_error_matches (temp_error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND))
|
|
||||||
{
|
|
||||||
g_clear_error (&temp_error);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
g_propagate_error (error, temp_error);
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = TRUE;
|
|
||||||
ot_transfer_out_value (out_info, &ret_file_info);
|
|
||||||
out:
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
gboolean
|
|
||||||
ot_gfile_query_symlink_target_allow_noent (GFile *path,
|
|
||||||
GFile **out_target,
|
|
||||||
GCancellable *cancellable,
|
|
||||||
GError **error)
|
|
||||||
{
|
|
||||||
gboolean ret = FALSE;
|
|
||||||
g_autoptr(GFileInfo) file_info = NULL;
|
|
||||||
g_autoptr(GFile) ret_target = NULL;
|
|
||||||
|
|
||||||
if (!ot_gfile_query_info_allow_noent (path, OSTREE_GIO_FAST_QUERYINFO,
|
|
||||||
G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
|
|
||||||
&file_info,
|
|
||||||
cancellable, error))
|
|
||||||
goto out;
|
|
||||||
|
|
||||||
if (file_info != NULL)
|
|
||||||
{
|
|
||||||
if (!ot_gfile_get_symlink_target_from_info (path, file_info, &ret_target,
|
|
||||||
cancellable, error))
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = TRUE;
|
|
||||||
ot_transfer_out_value (out_target, &ret_target);
|
|
||||||
out:
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
gboolean
|
|
||||||
ot_gfile_load_contents_utf8_allow_noent (GFile *path,
|
|
||||||
char **out_contents,
|
|
||||||
GCancellable *cancellable,
|
|
||||||
GError **error)
|
|
||||||
{
|
|
||||||
gboolean ret = FALSE;
|
|
||||||
GError *temp_error = NULL;
|
|
||||||
g_autofree char *ret_contents = NULL;
|
|
||||||
|
|
||||||
ret_contents = glnx_file_get_contents_utf8_at (AT_FDCWD, gs_file_get_path_cached (path), NULL,
|
|
||||||
cancellable, &temp_error);
|
|
||||||
if (!ret_contents)
|
|
||||||
{
|
|
||||||
if (g_error_matches (temp_error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND))
|
|
||||||
{
|
|
||||||
g_clear_error (&temp_error);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
g_propagate_error (error, temp_error);
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = TRUE;
|
|
||||||
ot_transfer_out_value (out_contents, &ret_contents);
|
|
||||||
out:
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ot_gfile_replace_contents_fsync:
|
* ot_gfile_replace_contents_fsync:
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -39,37 +39,6 @@ GFile * ot_gfile_resolve_path_printf (GFile *path,
|
||||||
const char *format,
|
const char *format,
|
||||||
...) G_GNUC_PRINTF(2, 3);
|
...) G_GNUC_PRINTF(2, 3);
|
||||||
|
|
||||||
|
|
||||||
gboolean ot_gfile_get_symlink_target_from_info (GFile *path,
|
|
||||||
GFileInfo *file_info,
|
|
||||||
GFile **out_target,
|
|
||||||
GCancellable *cancellable,
|
|
||||||
GError **error);
|
|
||||||
|
|
||||||
gboolean ot_gfile_query_info_allow_noent (GFile *path,
|
|
||||||
const char *queryopts,
|
|
||||||
GFileQueryInfoFlags flags,
|
|
||||||
GFileInfo **out_info,
|
|
||||||
GCancellable *cancellable,
|
|
||||||
GError **error);
|
|
||||||
|
|
||||||
gboolean ot_gfile_query_symlink_target_allow_noent (GFile *path,
|
|
||||||
GFile **out_target,
|
|
||||||
GCancellable *cancellable,
|
|
||||||
GError **error);
|
|
||||||
|
|
||||||
gboolean ot_gfile_load_contents_utf8_allow_noent (GFile *path,
|
|
||||||
char **out_contents,
|
|
||||||
GCancellable *cancellable,
|
|
||||||
GError **error);
|
|
||||||
|
|
||||||
gboolean ot_file_replace_contents_at (int dfd,
|
|
||||||
const char *path,
|
|
||||||
GBytes *contents,
|
|
||||||
gboolean datasync,
|
|
||||||
GCancellable *cancellable,
|
|
||||||
GError **error);
|
|
||||||
|
|
||||||
gboolean ot_gfile_replace_contents_fsync (GFile *path,
|
gboolean ot_gfile_replace_contents_fsync (GFile *path,
|
||||||
GBytes *contents,
|
GBytes *contents,
|
||||||
GCancellable *cancellable,
|
GCancellable *cancellable,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue