nitg: create .nit_compile before creating file inside
authorJean Privat <jean@pryen.org>
Thu, 6 Jun 2013 02:28:02 +0000 (22:28 -0400)
committerJean Privat <jean@pryen.org>
Thu, 6 Jun 2013 02:28:02 +0000 (22:28 -0400)
This solves the crash if missing .nit_compile problem.

Signed-off-by: Jean Privat <jean@pryen.org>

src/abstract_compiler.nit

index a5d43c3..36edf73 100644 (file)
@@ -65,6 +65,8 @@ redef class ModelBuilder
                # Note that we do not try to be clever an a small change in a Nit source file may change the content of all the generated .c files
                var time0 = get_time
 
+               ".nit_compile".mkdir
+
                var outname = self.toolcontext.opt_output.value
                if outname == null then
                        outname = "{mainmodule.name}.bin"
@@ -83,7 +85,6 @@ redef class ModelBuilder
                var file: nullable OFStream = null
                var count = 0
 
-               ".nit_compile".mkdir
                var i = 0
                for vis in compiler.visitors do
                        count += vis.lines.length