From 934dbe35182af9760c4c916bd99e4603a988c01d Mon Sep 17 00:00:00 2001 From: Simon Robertshaw Date: Sun, 24 Feb 2013 11:00:51 +0000 Subject: [PATCH] Fix auto directory creation for generator on Windows --- generator.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/generator.py b/generator.py index 35c4d2c13..7828e022c 100644 --- a/generator.py +++ b/generator.py @@ -120,8 +120,10 @@ std::vector GetElements() } """; - if not os.path.exists(outputH.split("/")[1]): - os.makedirs(outputH.split("/")[1]) + outputPath, outputFile = os.path.split(outputH) + if not os.path.exists(outputPath): + os.makedirs(outputPath) + f = open(outputH, "w") f.write(elementHeader) f.close() @@ -196,8 +198,10 @@ def generateTools(toolFiles, outputCpp, outputH): } """; - if not os.path.exists(outputH.split("/")[1]): - os.makedirs(outputH.split("/")[1]) + outputPath, outputFile = os.path.split(outputH) + if not os.path.exists(outputPath): + os.makedirs(outputPath) + f = open(outputH, "w") f.write(toolHeader) f.close()