From f12fc4066e35b34d3ff504842bcbf513256c52ec Mon Sep 17 00:00:00 2001 From: Adrian Kummerlaender Date: Wed, 23 Jul 2014 19:07:28 +0200 Subject: Added directory creation to FunctionGenerate and FunctionWriteFile * i.e. they now create the directory tree required to contain their respective output files automatically * this is needed so TestXSLT is able to create the target directory implicitly --- src/function/generate.cc | 1 + src/function/write_file.cc | 1 + 2 files changed, 2 insertions(+) diff --git a/src/function/generate.cc b/src/function/generate.cc index 4ece322..0c5c664 100644 --- a/src/function/generate.cc +++ b/src/function/generate.cc @@ -26,6 +26,7 @@ DomDocumentCache::document_ptr FunctionGenerate::constructDocument( ResultNodeFacade result(domDocument.get(), "generation"); result.setAttribute("path", targetPath.string()); + boost::filesystem::create_directories(targetPath.parent_path()); boost::filesystem::ofstream file(targetPath); if ( file.is_open() ) { diff --git a/src/function/write_file.cc b/src/function/write_file.cc index 06fdcfd..70412d7 100644 --- a/src/function/write_file.cc +++ b/src/function/write_file.cc @@ -24,6 +24,7 @@ bool serializeNodeToFile( if ( contentType != xalan::XalanNode::DOCUMENT_NODE && contentType != xalan::XalanNode::ATTRIBUTE_NODE ) { + boost::filesystem::create_directories(filePath.parent_path()); boost::filesystem::ofstream file(filePath); if ( file.is_open() ) { -- cgit v1.2.3