From ddd440433809abf173d910ac94e8dcfa657b784f Mon Sep 17 00:00:00 2001
From: dblouin <dominique.blouin@telecom-paristech.fr>
Date: Tue, 21 Nov 2017 14:13:06 +0100
Subject: [PATCH] Issue #98: Use the code gen directory passes to method

---
 src/main/java/ui/GTURTLEModeling.java | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/src/main/java/ui/GTURTLEModeling.java b/src/main/java/ui/GTURTLEModeling.java
index a704878571..d7f1aff3f6 100755
--- a/src/main/java/ui/GTURTLEModeling.java
+++ b/src/main/java/ui/GTURTLEModeling.java
@@ -472,11 +472,18 @@ public class GTURTLEModeling {
         // Parse the PEC file and the library of code snippets for each DIPLODOCUS unit
         applicationName = tmap.getMappedTasks().get(0).getName().split("__")[0];        // Remember that it works only for one application
         CCode = new TMLModelCompiler( directory, applicationName, mgui.frame, mgui.getAllTMLCP(), tmap );
+        
+        // Issue #98: Use the passed directory
         File dir = new File(directory /*ConfigurationTTool.CCodeDirectory*/ + File.separator);
-    	if (!dir.exists())
+    	
+        if ( !dir.exists() ) {
     		dir.mkdirs();
+        }
+        
         CCode.toTextFormat();
+        
         try {
+            // Issue #98: Use the passed directory
             if( directory/*ConfigurationTTool.CCodeDirectory*/.equals("") )  {
                 JOptionPane.showMessageDialog(  mgui.frame,
                                                 "No directory for C code generation found in config.xml. The C code cannot be generated.",
@@ -484,6 +491,7 @@ public class GTURTLEModeling {
                 return true;
             }
             else                {
+                // Issue #98: Use the passed directory
                 CCode.saveFile( directory/*ConfigurationTTool.CCodeDirectory*/ + File.separator, applicationName );
             }
         }
-- 
GitLab