Only monitor actually existing user script/ style folders

This commit is contained in:
Alexander Butenko 2009-12-21 23:36:22 +01:00 committed by Christian Dywan
parent dc288dd3c3
commit eddb3ef557

View file

@ -22,9 +22,14 @@
#include <webkit/webkit.h> #include <webkit/webkit.h>
#include <JavaScriptCore/JavaScript.h> #include <JavaScriptCore/JavaScript.h>
#include <glib/gi18n.h> #include <glib/gi18n.h>
#include <glib/gstdio.h>
#include <string.h> #include <string.h>
#include <gio/gio.h> #include <gio/gio.h>
#if HAVE_UNISTD_H
#include <unistd.h>
#endif
struct _MidoriAddons struct _MidoriAddons
{ {
GtkVBox parent_instance; GtkVBox parent_instance;
@ -212,14 +217,20 @@ _addons_get_directories (MidoriAddons* addons)
{ {
path = g_build_path (G_DIR_SEPARATOR_S, g_get_user_data_dir (), path = g_build_path (G_DIR_SEPARATOR_S, g_get_user_data_dir (),
PACKAGE_NAME, folders[i], NULL); PACKAGE_NAME, folders[i], NULL);
directories = g_slist_prepend (directories, path); if (g_access (path, X_OK) == 0)
directories = g_slist_prepend (directories, path);
else
g_free (path);
datadirs = g_get_system_data_dirs (); datadirs = g_get_system_data_dirs ();
while (*datadirs) while (*datadirs)
{ {
path = g_build_path (G_DIR_SEPARATOR_S, *datadirs, path = g_build_path (G_DIR_SEPARATOR_S, *datadirs,
PACKAGE_NAME, folders[i], NULL); PACKAGE_NAME, folders[i], NULL);
directories = g_slist_prepend (directories, path); if (g_access (path, X_OK) == 0)
directories = g_slist_prepend (directories, path);
else
g_free (path);
datadirs++; datadirs++;
} }
} }