]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
Create destination directory when writing C files
authorRémy Saissy <remy.saissy@gmail.com>
Sun, 23 May 2010 17:43:46 +0000 (19:43 +0200)
committerJürg Billeter <j@bitron.ch>
Mon, 7 Jun 2010 18:53:11 +0000 (20:53 +0200)
Fixes bug 612336.

ccode/valaccodewriter.vala

index ea10cbe822f3a604a65739362b52f6dc33d1b86f..8f2575437370a7919a005597606bfc06b04a16c0 100644 (file)
@@ -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");
                }