2010-11-23 21:54:39 -08:00
|
|
|
#include "config.h"
|
|
|
|
#include "mooutils-file.h"
|
|
|
|
#include "mooutils.h"
|
|
|
|
#include <fnmatch.h>
|
|
|
|
|
2010-12-12 02:29:20 -08:00
|
|
|
MOO_DEFINE_OBJECT_ARRAY_FULL (MooFileArray, moo_file_array, GFile)
|
2010-11-23 21:54:39 -08:00
|
|
|
|
|
|
|
char *
|
|
|
|
moo_file_get_display_name (GFile *file)
|
|
|
|
{
|
2011-01-14 02:37:04 -08:00
|
|
|
g_return_val_if_fail (G_IS_FILE (file), NULL);
|
2010-11-23 21:54:39 -08:00
|
|
|
return g_file_get_parse_name (file);
|
|
|
|
}
|
|
|
|
|
|
|
|
gboolean
|
|
|
|
moo_file_fnmatch (GFile *file,
|
|
|
|
const char *glob)
|
|
|
|
{
|
|
|
|
char *filename;
|
2010-12-14 23:53:27 -08:00
|
|
|
gboolean ret;
|
2010-11-23 21:54:39 -08:00
|
|
|
|
2011-01-14 02:37:04 -08:00
|
|
|
g_return_val_if_fail (G_IS_FILE (file), FALSE);
|
|
|
|
g_return_val_if_fail (glob != NULL, FALSE);
|
2010-11-23 21:54:39 -08:00
|
|
|
|
|
|
|
filename = g_file_get_path (file);
|
2011-01-14 02:37:04 -08:00
|
|
|
g_return_val_if_fail (filename != NULL, FALSE);
|
2010-11-23 21:54:39 -08:00
|
|
|
|
2010-12-14 23:53:27 -08:00
|
|
|
ret = fnmatch (glob, filename, 0) == 0;
|
|
|
|
|
|
|
|
g_free (filename);
|
|
|
|
return ret;
|
2010-11-23 21:54:39 -08:00
|
|
|
}
|