diff --git a/samples/yaml-tonode.vala b/samples/yaml-tonode.vala index 1c2cc7a..fe68969 100644 --- a/samples/yaml-tonode.vala +++ b/samples/yaml-tonode.vala @@ -28,7 +28,6 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - using GLib; using Gee; using Pluie; @@ -47,31 +46,6 @@ int main (string[] args) root.display_childs (); var obj = (Yaml.Example) Yaml.Builder.from_node (root.first ()); - of.action ("Getting Hard coded values for Yaml.Object %s".printf (of.c (ECHO.MICROTIME).s (obj.get_type().name ())), obj.yaml_name); - of.keyval("yaml_name" , "%s" .printf(obj.yaml_name)); - of.keyval("type_int" , "%d" .printf(obj.type_int)); - of.keyval("type_bool" , "%s" .printf(obj.type_bool.to_string ())); - of.keyval("type_char" , "%c" .printf(obj.type_char)); - of.keyval("type_string" , "%s" .printf(obj.type_string)); - of.keyval("type_uchar" , "%c" .printf(obj.type_uchar)); - of.keyval("type_uint" , "%u" .printf(obj.type_uint)); - of.keyval("type_float" , "%f" .printf(obj.type_float)); - of.keyval("type_double" , "%f" .printf(obj.type_double)); - of.keyval("type_enum" , "%s" .printf(obj.type_enum.to_string ())); - of.keyval("type_struct" , "%s" .printf(obj.type_struct.to_string ())); - of.keyval("type_object" , "%s" .printf(obj.type_object.get_type ().name ())); - of.keyval(" toto" , "%s (string)" .printf(obj.type_object.toto)); - of.keyval(" tapa" , "%s (string)" .printf(obj.type_object.tata)); - of.keyval(" titi" , "%d (int)" .printf(obj.type_object.titi)); - of.keyval(" tutu" , "%s (bool)" .printf(obj.type_object.tutu.to_string ())); - obj.type_object.method_a (); - if (obj.type_gee_al != null) { - of.keyval("type_gee_al", "(%s)" .printf(obj.type_gee_al.get_type ().name ())); - foreach (string v in obj.type_gee_al) { - of.echo(" - item : %s".printf (v)); - } - } - var n = Yaml.Builder.to_node (obj); if ((done = n !=null)) { n.display_childs (); diff --git a/src/vala/Pluie/Yaml.Scanner.vala b/src/vala/Pluie/Yaml.Scanner.vala index 654b3ce..b2c9a2e 100644 --- a/src/vala/Pluie/Yaml.Scanner.vala +++ b/src/vala/Pluie/Yaml.Scanner.vala @@ -38,6 +38,7 @@ extern void yaml_parse_file(string srcPath, string destPath); */ public class Pluie.Yaml.Scanner { + string path; /** * Regex pattern use to find EVENT */ @@ -112,9 +113,24 @@ public class Pluie.Yaml.Scanner */ public Scanner (string path) { - var destPath = Path.build_filename (Environment.get_tmp_dir (), Path.get_basename(path)); - yaml_parse_file(path, destPath); - this.reader = new Io.Reader (destPath); + var date = new GLib.DateTime.now_local ().format ("%s"); + this.path = Path.build_filename (Environment.get_tmp_dir (), "pluie-yaml-%s-%s.events".printf (date, Path.get_basename(path))); + yaml_parse_file(path, this.path); + this.reader = new Io.Reader (this.path); + } + + /** + * + */ + ~Scanner() + { + var f = GLib.File.new_for_path (this.path); + try { + f.delete (); + } + catch (GLib.Error e) { + of.error (e.message); + } } /**