skip files starting with '.' so we don't try to parse .DS_Store and other

2007-08-28  Michael Natterer  <mitch@gimp.org>

	* libgimpbase/gimpdatafiles.c (gimp_datafiles_read_directories):
	skip files starting with '.' so we don't try to parse .DS_Store
	and other metadata storage files. Also moved variables to local
	scopes.


svn path=/trunk/; revision=23388
This commit is contained in:
Michael Natterer 2007-08-28 12:31:29 +00:00 committed by Michael Natterer
parent 48fdc9e594
commit 5a62582a77
2 changed files with 24 additions and 9 deletions

View File

@ -1,3 +1,10 @@
2007-08-28 Michael Natterer <mitch@gimp.org>
* libgimpbase/gimpdatafiles.c (gimp_datafiles_read_directories):
skip files starting with '.' so we don't try to parse .DS_Store
and other metadata storage files. Also moved variables to local
scopes.
2007-08-28 Tor Lillqvist <tml@novell.com>
* libgimpbase/gimpenv.c: Update doc comments about filename

View File

@ -113,15 +113,9 @@ gimp_datafiles_read_directories (const gchar *path_str,
GimpDatafileLoaderFunc loader_func,
gpointer user_data)
{
GimpDatafileData file_data;
struct stat filestat;
gchar *local_path;
GList *path;
GList *list;
gchar *filename;
gint err;
GDir *dir;
const gchar *dir_ent;
gchar *local_path;
GList *path;
GList *list;
g_return_if_fail (path_str != NULL);
g_return_if_fail (loader_func != NULL);
@ -133,13 +127,27 @@ gimp_datafiles_read_directories (const gchar *path_str,
for (list = path; list; list = g_list_next (list))
{
const gchar *dirname = list->data;
GDir *dir;
dir = g_dir_open (dirname, 0, NULL);
if (dir)
{
const gchar *dir_ent;
while ((dir_ent = g_dir_read_name (dir)))
{
GimpDatafileData file_data;
struct stat filestat;
gchar *filename;
gint err;
/* skip files starting with '.' so we don't try to parse
* stuff like .DS_Store or other metadata storage files
*/
if (dir_ent[0] == '.')
continue;
filename = g_build_filename (dirname, dir_ent, NULL);
err = g_stat (filename, &filestat);