[gegl] bin: handle both xml and gegl-chain formatted files on commandline



commit 153beacf96331ca20e4f87ca0dc4d685b2851749
Author: Øyvind Kolås <pippin gimp org>
Date:   Tue Apr 4 20:42:51 2017 +0200

    bin: handle both xml and gegl-chain formatted files on commandline

 bin/gegl.c |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)
---
diff --git a/bin/gegl.c b/bin/gegl.c
index a1e075c..f0fa224 100644
--- a/bin/gegl.c
+++ b/bin/gegl.c
@@ -79,6 +79,11 @@ static gboolean file_is_gegl_xml (const gchar *path)
   return FALSE;
 }
 
+static gboolean is_xml_fragment (const char *data)
+{
+  return strchr (data, '>') && strchr (data, '<'); //XXX: this should be better
+}
+
 int mrg_ui_main (int argc, char **argv, char **ops);
 
 gint
@@ -198,7 +203,10 @@ main (gint    argc,
 #endif
     }
 
-  gegl = gegl_node_new_from_xml (script, path_root);
+  if (is_xml_fragment (script))
+    gegl = gegl_node_new_from_xml (script, path_root);
+  else
+    gegl = gegl_node_new_from_serialized (script, path_root);
 
   if (!gegl)
     {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]