[gnome-builder/wip/libide: 222/237] libide: filter unknown script formats
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/wip/libide: 222/237] libide: filter unknown script formats
- Date: Tue, 17 Feb 2015 21:48:04 +0000 (UTC)
commit a3663cc7bf232909524109fc871a4c9047a4d463
Author: Christian Hergert <christian hergert me>
Date: Mon Feb 16 13:50:16 2015 -0800
libide: filter unknown script formats
libide/ide-script-manager.c | 14 ++++++++++++++
1 files changed, 14 insertions(+), 0 deletions(-)
---
diff --git a/libide/ide-script-manager.c b/libide/ide-script-manager.c
index 4d8262c..a65c119 100644
--- a/libide/ide-script-manager.c
+++ b/libide/ide-script-manager.c
@@ -140,6 +140,17 @@ ide_script_manager_init (IdeScriptManager *self)
{
}
+static gboolean
+allow_file (const gchar *name)
+{
+ /* NOTE:
+ *
+ * Add your allowed suffix here if you are adding a new scripting language
+ * (ie: python, etc)
+ */
+ return g_str_has_suffix (name, ".js");
+}
+
static void
ide_script_manager_get_files_worker (GTask *task,
gpointer source_object,
@@ -171,6 +182,9 @@ ide_script_manager_get_files_worker (GTask *task,
g_autoptr(gchar) path = NULL;
g_autoptr(GFile) file = NULL;
+ if (!allow_file (name))
+ continue;
+
path = g_build_filename (directory, name, NULL);
file = g_file_new_for_path (path);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]