]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
doclets/gtkdoclet: Do not write C comments file in append mode
authorLuca Bruno <lethalman88@gmail.com>
Tue, 4 May 2010 19:49:11 +0000 (21:49 +0200)
committerFlorian Brosch <flo.brosch@gmail.com>
Tue, 4 May 2010 19:49:11 +0000 (21:49 +0200)
src/doclets/gtkdoc/generator.vala
src/doclets/gtkdoc/utils.vala

index ae4d1cc0b63b96b6db584acd1c5e7af410f66305..238b4878aa6cc1f19af773d37ac16689549bdd5f 100644 (file)
@@ -44,7 +44,7 @@ public class Gtkdoc.Generator : Api.Visitor {
                var sections = Path.build_filename (settings.path, "%s-sections.txt".printf (settings.pkg_name));
                DirUtils.create_with_parents (code_dir, 0777);
 
-               var sections_writer = new TextWriter (sections);
+               var sections_writer = new TextWriter (sections, "a");
                if (!sections_writer.open ()) {
                        warning ("GtkDoc: unable to open %s for writing", sections_writer.filename);
                        return false;
@@ -53,7 +53,7 @@ public class Gtkdoc.Generator : Api.Visitor {
                foreach (var file_data in files_data.values) {
                        // C comments
                        var basename = get_section (file_data.filename);
-                       var cwriter = new TextWriter (Path.build_filename (code_dir, "%s.c".printf (basename)));
+                       var cwriter = new TextWriter (Path.build_filename (code_dir, "%s.c".printf (basename)), "w");
 
                        if (!cwriter.open ()) {
                                warning ("GtkDoc: unable to open %s for writing", cwriter.filename);
index 500cdad7f3d1da663d1ec86f0589a3d02a5f5e89..4b853a16607f81fce56386e9035a2dc20d0e488a 100644 (file)
@@ -65,15 +65,17 @@ namespace Gtkdoc {
 
 public class Gtkdoc.TextWriter {
        public string filename;
+       public string mode;
 
        private FileStream? stream;
 
-       public TextWriter (string filename) {
+  public TextWriter (string filename, string mode) {
                this.filename = filename;
+               this.mode = mode;
        }
 
        public bool open () {
-               stream = FileStream.open (filename, "a");
+               stream = FileStream.open (filename, mode);
                return stream != null;
        }