mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-25 23:16:14 +01:00
Add g_file_query_file_type convenience function to query the type of a
2008-03-30 Matthias Clasen <mclasen@redhat.com> * gio.symbols: * gfile.c: * gfile.h: Add g_file_query_file_type convenience function to query the type of a file. (#520715, Mikkel Kamstrup Erlandsen) svn path=/trunk/; revision=6784
This commit is contained in:
parent
6bbef67ad6
commit
a07b747200
@ -1,3 +1,7 @@
|
|||||||
|
2008-03-30 Matthias Clasen <mclasen@redhat.com>
|
||||||
|
|
||||||
|
* gio/gio-sections.txt: Add g_file_query_file_type.
|
||||||
|
|
||||||
2008-03-30 Matthias Clasen <mclasen@redhat.com>
|
2008-03-30 Matthias Clasen <mclasen@redhat.com>
|
||||||
|
|
||||||
* glib/glib-sections.txt:
|
* glib/glib-sections.txt:
|
||||||
|
@ -70,6 +70,7 @@ g_file_query_info
|
|||||||
g_file_query_info_async
|
g_file_query_info_async
|
||||||
g_file_query_info_finish
|
g_file_query_info_finish
|
||||||
g_file_query_exists
|
g_file_query_exists
|
||||||
|
g_file_query_file_type
|
||||||
g_file_query_filesystem_info
|
g_file_query_filesystem_info
|
||||||
g_file_query_filesystem_info_async
|
g_file_query_filesystem_info_async
|
||||||
g_file_query_filesystem_info_finish
|
g_file_query_filesystem_info_finish
|
||||||
|
@ -1,3 +1,10 @@
|
|||||||
|
2008-03-30 Matthias Clasen <mclasen@redhat.com>
|
||||||
|
|
||||||
|
* gio.symbols:
|
||||||
|
* gfile.c:
|
||||||
|
* gfile.h: Add g_file_query_file_type convenience function
|
||||||
|
to query the type of a file. (#520715, Mikkel Kamstrup Erlandsen)
|
||||||
|
|
||||||
2008-03-30 Matthias Clasen <mclasen@redhat.com>
|
2008-03-30 Matthias Clasen <mclasen@redhat.com>
|
||||||
|
|
||||||
* gfileenumerator.c:
|
* gfileenumerator.c:
|
||||||
|
42
gio/gfile.c
42
gio/gfile.c
@ -931,8 +931,7 @@ g_file_query_exists (GFile *file,
|
|||||||
g_return_val_if_fail (G_IS_FILE(file), FALSE);
|
g_return_val_if_fail (G_IS_FILE(file), FALSE);
|
||||||
|
|
||||||
info = g_file_query_info (file, G_FILE_ATTRIBUTE_STANDARD_TYPE,
|
info = g_file_query_info (file, G_FILE_ATTRIBUTE_STANDARD_TYPE,
|
||||||
G_FILE_QUERY_INFO_NONE,
|
G_FILE_QUERY_INFO_NONE, cancellable, NULL);
|
||||||
cancellable, NULL);
|
|
||||||
if (info != NULL)
|
if (info != NULL)
|
||||||
{
|
{
|
||||||
g_object_unref (info);
|
g_object_unref (info);
|
||||||
@ -942,6 +941,45 @@ g_file_query_exists (GFile *file,
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* g_file_query_file_type:
|
||||||
|
* @file: input #GFile.
|
||||||
|
* @flags: a set of #GFileQueryInfoFlags passed to g_file_query_info().
|
||||||
|
* @cancellable: optional #GCancellable object, %NULL to ignore.
|
||||||
|
*
|
||||||
|
* Utility function to inspect the #GFileType of a file. This is
|
||||||
|
* implemented using g_file_query_info() and as such does blocking I/O.
|
||||||
|
*
|
||||||
|
* The primary use case of this method is to check if a file is a regular file,
|
||||||
|
* directory, or symlink.
|
||||||
|
*
|
||||||
|
* Returns: The #GFileType of the file and #G_FILE_TYPE_UNKNOWN if the file
|
||||||
|
* does not exist
|
||||||
|
*
|
||||||
|
* Since: 2.18
|
||||||
|
*/
|
||||||
|
GFileType
|
||||||
|
g_file_query_file_type (GFile *file,
|
||||||
|
GFileQueryInfoFlags flags,
|
||||||
|
GCancellable *cancellable)
|
||||||
|
{
|
||||||
|
GFileInfo *info;
|
||||||
|
GFileType file_type;
|
||||||
|
|
||||||
|
g_return_val_if_fail (G_IS_FILE(file), FALSE);
|
||||||
|
info = g_file_query_info (file, G_FILE_ATTRIBUTE_STANDARD_TYPE, flags,
|
||||||
|
cancellable, NULL);
|
||||||
|
if (info != NULL)
|
||||||
|
{
|
||||||
|
file_type = g_file_info_get_file_type (info);
|
||||||
|
g_object_unref (info);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
file_type = G_FILE_TYPE_UNKNOWN;
|
||||||
|
|
||||||
|
return file_type;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* g_file_query_info:
|
* g_file_query_info:
|
||||||
* @file: input #GFile.
|
* @file: input #GFile.
|
||||||
|
@ -646,6 +646,9 @@ GFileOutputStream * g_file_replace_finish (GFile
|
|||||||
GError **error);
|
GError **error);
|
||||||
gboolean g_file_query_exists (GFile *file,
|
gboolean g_file_query_exists (GFile *file,
|
||||||
GCancellable *cancellable);
|
GCancellable *cancellable);
|
||||||
|
GFileType g_file_query_file_type (GFile *file,
|
||||||
|
GFileQueryInfoFlags flags,
|
||||||
|
GCancellable *cancellable);
|
||||||
GFileInfo * g_file_query_info (GFile *file,
|
GFileInfo * g_file_query_info (GFile *file,
|
||||||
const char *attributes,
|
const char *attributes,
|
||||||
GFileQueryInfoFlags flags,
|
GFileQueryInfoFlags flags,
|
||||||
|
@ -252,6 +252,7 @@ g_file_query_exists
|
|||||||
g_file_query_info
|
g_file_query_info
|
||||||
g_file_query_info_async
|
g_file_query_info_async
|
||||||
g_file_query_info_finish
|
g_file_query_info_finish
|
||||||
|
g_file_query_file_type
|
||||||
g_file_query_filesystem_info
|
g_file_query_filesystem_info
|
||||||
g_file_query_filesystem_info_async
|
g_file_query_filesystem_info_async
|
||||||
g_file_query_filesystem_info_finish
|
g_file_query_filesystem_info_finish
|
||||||
|
Loading…
Reference in New Issue
Block a user