Use g_access instead of g_file_test in katze_mkdir_with_parents

This commit is contained in:
Alexander Butenko 2009-12-18 21:21:02 +01:00 committed by Christian Dywan
parent 8c724eccd9
commit 670ee72e3f

View file

@ -21,6 +21,10 @@
#include "config.h" #include "config.h"
#endif #endif
#if HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifdef HAVE_HILDON_2_2 #ifdef HAVE_HILDON_2_2
#include <hildon/hildon.h> #include <hildon/hildon.h>
#endif #endif
@ -1340,7 +1344,8 @@ katze_mkdir_with_parents (const gchar* pathname,
{ {
gchar* fn, *p; gchar* fn, *p;
if (g_file_test (pathname, G_FILE_TEST_EXISTS)) /* Use g_access instead of g_file_test for better performance */
if (g_access (pathname, F_OK) == 0)
return 0; return 0;
fn = g_strdup (pathname); fn = g_strdup (pathname);
@ -1360,7 +1365,7 @@ katze_mkdir_with_parents (const gchar* pathname,
else else
*p = '\0'; *p = '\0';
if (!g_file_test (fn, G_FILE_TEST_EXISTS)) if (g_access (fn, F_OK) != 0)
{ {
if (g_mkdir (fn, mode) == -1) if (g_mkdir (fn, mode) == -1)
{ {