From 6c22590d4ace548c26edc17060b074538e483499 Mon Sep 17 00:00:00 2001 From: Brian Sidebotham Date: Tue, 1 Jan 2013 14:39:25 -0600 Subject: [PATCH] Fixes a bug in the template file copying mechanism. The previous code failed to honour sub-directorys and flattened the whole tree whilst copying files. I have fixed this so that sub-directories that are not the meta directory will get copied verbatim into the new project directory. --- kicad/project_template.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/kicad/project_template.cpp b/kicad/project_template.cpp index 474e08e610..f5f130aba6 100644 --- a/kicad/project_template.cpp +++ b/kicad/project_template.cpp @@ -139,7 +139,13 @@ bool PROJECT_TEMPLATE::CreateProject( wxFileName& aNewProjectPath ) destname += wxT(".") + destination.GetExt(); wxString destpath = destination.GetPathWithSep(); - destpath.Replace( destination.GetPathWithSep(), aNewProjectPath.GetPathWithSep() ); + destpath.Replace( templateBasePath.GetPathWithSep(), aNewProjectPath.GetPathWithSep() ); + + // Check to see if the path already exists, if not attempt to create it here. Don't worry + // about error checking, if the path isn't created the file copy will fail anyway + + if( !wxFileName::DirExists( destpath ) ) + wxFileName::Mkdir( destpath, 0777, wxPATH_MKDIR_FULL ); destination = destpath + destname; dstFiles.push_back( destination );