[valadoc] doclets/gtkdoclet: Do not write C comments file in append mode



commit e147ab09d7dbbcc129c27a2e35b1ec8c8a9d0ebf
Author: Luca Bruno <lethalman88 gmail com>
Date:   Tue May 4 21:49:11 2010 +0200

    doclets/gtkdoclet: Do not write C comments file in append mode

 src/doclets/gtkdoc/generator.vala |    4 ++--
 src/doclets/gtkdoc/utils.vala     |    6 ++++--
 2 files changed, 6 insertions(+), 4 deletions(-)
---
diff --git a/src/doclets/gtkdoc/generator.vala b/src/doclets/gtkdoc/generator.vala
index ae4d1cc..238b487 100644
--- a/src/doclets/gtkdoc/generator.vala
+++ b/src/doclets/gtkdoc/generator.vala
@@ -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);
diff --git a/src/doclets/gtkdoc/utils.vala b/src/doclets/gtkdoc/utils.vala
index 500cdad..4b853a1 100644
--- a/src/doclets/gtkdoc/utils.vala
+++ b/src/doclets/gtkdoc/utils.vala
@@ -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;
 	}
 



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