Fix bug about inexistent directories
[bertos.git] / wizard / bertos_utils.py
index 2bc44ab54d0fa385fc55964860925466a97c448f..ec52a21050acd81b7d341fd2ba8f69c069724b49 100644 (file)
@@ -55,8 +55,9 @@ def bertosVersion(directory):
 def createBertosProject(project_info):
     directory = project_info.info("PROJECT_PATH")
     sources_dir = project_info.info("SOURCES_PATH")
-    if not os.path.isdir(directory):
-        os.mkdir(directory)
+    if os.path.isdir(directory):
+        shutil.rmtree(directory, True)        
+    os.makedirs(directory)
     f = open(directory + "/project.bertos", "w")
     f.write(pickle.dumps(project_info))
     f.close()
@@ -228,7 +229,7 @@ def csrcGenerator(project_info):
     cppasrc = " \\\n\t".join(cppasrc) + " \\"
     cxxsrc = " \\\n\t".join(cxxsrc) + " \\"
     asrc = " \\\n\t".join(asrc) + " \\"
-    constants = "\n".join([os.path.basename(project_info.info("PROJECT_PATH")) + "_" + key + " = " + str(value) for key, value in constants.items()])
+    constants = "\n".join([os.path.basename(project_info.info("PROJECT_PATH")) + "_" + key + " = " + unicode(value) for key, value in constants.items()])
     return csrc, pcsrc, cppasrc, cxxsrc, asrc, constants
 
 def findModuleFiles(module, project_info):