[vala] Create destination directory when writing C files



commit 43ce3d5003afdc4d561cf5f83b0693db870977b2
Author: Rémy Saissy <remy saissy gmail com>
Date:   Sun May 23 19:43:46 2010 +0200

    Create destination directory when writing C files
    
    Fixes bug 612336.

 ccode/valaccodewriter.vala |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
---
diff --git a/ccode/valaccodewriter.vala b/ccode/valaccodewriter.vala
index ea10cbe..8f25754 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");
 		}
 



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