# HG changeset patch
# User Laurent Bessard
# Date 1366822237 -7200
# Node ID 9b5995303db13ae2f2ddfe76cb3318ad5c1c3cc7
# Parent  fd7c9a7cf882a62b6ff6cfabc717bff89dab0bf7
Fixed bug in Save function in Beremiz

diff -r fd7c9a7cf882 -r 9b5995303db1 ConfigTreeNode.py
--- a/ConfigTreeNode.py	Wed Apr 24 17:37:46 2013 +0200
+++ b/ConfigTreeNode.py	Wed Apr 24 18:50:37 2013 +0200
@@ -188,8 +188,10 @@
             self.ChangesToSave = False
             # go through all children and do the same
             for CTNChild in self.IterChildren():
-                result = CTNChild.CTNRequestSave(
-                    CTNChild.CTNPath(project_path=from_project_path))
+                CTNChildPath = None
+                if from_project_path is not None:
+                    CTNChildPath = CTNChild.CTNPath(project_path=from_project_path)
+                result = CTNChild.CTNRequestSave(CTNChildPath)
                 if result:
                     return result
         return None
diff -r fd7c9a7cf882 -r 9b5995303db1 canfestival/canfestival.py
--- a/canfestival/canfestival.py	Wed Apr 24 17:37:46 2013 +0200
+++ b/canfestival/canfestival.py	Wed Apr 24 18:50:37 2013 +0200
@@ -380,8 +380,9 @@
         
     def OnCTNSave(self, from_project_path=None):
         self.SetRoot(self.CTNPath())
-        shutil.copytree(self.GetEDSFolder(from_project_path), 
-                        self.GetEDSFolder())
+        if from_project_path is not None:
+            shutil.copytree(self.GetEDSFolder(from_project_path), 
+                            self.GetEDSFolder())
         return self.SaveProject() is None
 
     def CTNGenerate_C(self, buildpath, locations):