Based on patch by pancake, fixes bug 606837.
private string temp_filename;
private bool file_exists;
- private FileStream stream;
+ private FileStream? stream;
private int indent;
private int current_line_number = 1;
stream = FileStream.open (filename, "w");
}
+ if (stream == null) {
+ return false;
+ }
+
write_string ("/* %s generated by valac, the Vala compiler".printf (Path.get_basename (filename)));
// Write the file name if known
write_newline ();
write_newline ();
- return (stream != null);
+ return true;
}
/**
// generate symbols file for public API
if (context.symbols_filename != null) {
var stream = FileStream.open (context.symbols_filename, "w");
+ if (stream == null) {
+ Report.error (null, "unable to open `%s' for writing".printf (context.symbols_filename));
+ return;
+ }
foreach (CCodeNode node in header_declarations.type_member_declaration.get_children ()) {
if (node is CCodeFunction) {
/* valagirwriter.vala
*
- * Copyright (C) 2008-2009 Jürg Billeter
+ * Copyright (C) 2008-2010 Jürg Billeter
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
string filename = "%s%c%s-%s.gir".printf (directory, Path.DIR_SEPARATOR, gir_namespace, gir_version);
stream = FileStream.open (filename, "w");
+ if (stream == null) {
+ Report.error (null, "unable to open `%s' for writing".printf (filename));
+ return;
+ }
stream.printf ("<?xml version=\"1.0\"?>\n");
this.context = context;
stream = FileStream.open (filename, "w");
+ if (stream == null) {
+ Report.error (null, "unable to open `%s' for writing".printf (filename));
+ return;
+ }
write_string ("/* %s generated by %s, do not modify. */".printf (Path.get_basename (filename), Environment.get_prgname ()));
write_newline ();