From: Rémy Saissy Date: Sun, 23 May 2010 17:43:46 +0000 (+0200) Subject: Create destination directory when writing C files X-Git-Tag: 0.9.1~4 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=43ce3d5003afdc4d561cf5f83b0693db870977b2;p=thirdparty%2Fvala.git Create destination directory when writing C files Fixes bug 612336. --- diff --git a/ccode/valaccodewriter.vala b/ccode/valaccodewriter.vala index ea10cbe82..8f2575437 100644 --- a/ccode/valaccodewriter.vala +++ b/ccode/valaccodewriter.vala @@ -77,6 +77,12 @@ public class Vala.CCodeWriter { temp_filename = "%s.valatmp".printf (filename); stream = FileStream.open (temp_filename, "w"); } else { + /* + * File doesn't exist. In case of a particular destination (-d flag), + * check and create the directory structure. + */ + var dirname = Path.get_dirname (filename); + DirUtils.create_with_parents (dirname, 0755); stream = FileStream.open (filename, "w"); }