aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/function/base.h8
-rw-r--r--src/function/external_command.cc4
-rw-r--r--src/function/external_command.h1
-rw-r--r--src/function/generate.cc7
-rw-r--r--src/function/generate.h1
-rw-r--r--src/function/read_directory.cc4
-rw-r--r--src/function/read_directory.h4
-rw-r--r--src/function/read_file.cc4
-rw-r--r--src/function/read_file.h4
-rw-r--r--src/function/transform.cc5
-rw-r--r--src/function/transform.h1
-rw-r--r--src/function/write_file.cc5
-rw-r--r--src/function/write_file.h1
-rw-r--r--src/support/type/xobject_value.cc10
-rw-r--r--src/support/type/xobject_value.h4
15 files changed, 42 insertions, 21 deletions
diff --git a/src/function/base.h b/src/function/base.h
index 3726aa8..d53ae8a 100644
--- a/src/function/base.h
+++ b/src/function/base.h
@@ -120,15 +120,17 @@ class FunctionBase : public xalan::Function {
const xalan::Locator* locator,
Sequence<Index...>
) const {
- XObjectValue valueGetter(
+ const FilesystemContext context(
IncludeEntityResolver::getPathFromSystemId(
locator->getSystemId()
- ),
- this->include_resolver_
+ )
);
+ XObjectValue valueGetter(&context, this->include_resolver_);
+
return this->document_cache_->create(
static_cast<const Implementation*>(this)->constructDocument(
+ context,
valueGetter.get<typename std::tuple_element<
Index,
std::tuple<Types...>
diff --git a/src/function/external_command.cc b/src/function/external_command.cc
index 7d91a9a..3819a43 100644
--- a/src/function/external_command.cc
+++ b/src/function/external_command.cc
@@ -40,6 +40,7 @@ inline xercesc::DOMNode* importDocumentElement(
namespace InputXSLT {
DomDocumentCache::document_ptr FunctionExternalCommand::constructDocument(
+ const FilesystemContext& fsContext,
std::string command,
boost::optional<std::string> input
) const {
@@ -51,6 +52,9 @@ DomDocumentCache::document_ptr FunctionExternalCommand::constructDocument(
context.environment = boost::process::self::get_environment();
context.stdout_behavior = boost::process::capture_stream();
context.stdin_behavior = boost::process::capture_stream();
+ context.work_directory = boost::filesystem::canonical(
+ fsContext.getBase().parent_path()
+ ).string();
boost::process::child commandProcess(
boost::process::launch_shell(command, context)
diff --git a/src/function/external_command.h b/src/function/external_command.h
index 8af5079..3c4579d 100644
--- a/src/function/external_command.h
+++ b/src/function/external_command.h
@@ -20,6 +20,7 @@ class FunctionExternalCommand : public FunctionBase<
friend FunctionBase;
DomDocumentCache::document_ptr constructDocument(
+ const FilesystemContext&,
std::string,
boost::optional<std::string>
) const;
diff --git a/src/function/generate.cc b/src/function/generate.cc
index df5e65b..f9cd449 100644
--- a/src/function/generate.cc
+++ b/src/function/generate.cc
@@ -15,9 +15,10 @@
namespace InputXSLT {
DomDocumentCache::document_ptr FunctionGenerate::constructDocument(
- xalan::XSLTInputSource inputSource,
- xalan::XSLTInputSource transformationSource,
- boost::filesystem::path targetPath
+ const FilesystemContext&,
+ xalan::XSLTInputSource inputSource,
+ xalan::XSLTInputSource transformationSource,
+ boost::filesystem::path targetPath
) const {
DomDocumentCache::document_ptr domDocument(
DomDocumentCache::createDocument("content")
diff --git a/src/function/generate.h b/src/function/generate.h
index 43f5da1..333ed37 100644
--- a/src/function/generate.h
+++ b/src/function/generate.h
@@ -20,6 +20,7 @@ class FunctionGenerate : public FunctionBase<
friend FunctionBase;
DomDocumentCache::document_ptr constructDocument(
+ const FilesystemContext&,
xalan::XSLTInputSource,
xalan::XSLTInputSource,
boost::filesystem::path
diff --git a/src/function/read_directory.cc b/src/function/read_directory.cc
index 8436459..d630e5d 100644
--- a/src/function/read_directory.cc
+++ b/src/function/read_directory.cc
@@ -6,7 +6,9 @@
namespace InputXSLT {
DomDocumentCache::document_ptr FunctionReadDirectory::constructDocument(
- boost::filesystem::path directoryPath) const {
+ const FilesystemContext&,
+ boost::filesystem::path directoryPath
+) const {
DomDocumentCache::document_ptr domDocument(
DomDocumentCache::createDocument("content")
);
diff --git a/src/function/read_directory.h b/src/function/read_directory.h
index 914f9b3..814d2ae 100644
--- a/src/function/read_directory.h
+++ b/src/function/read_directory.h
@@ -18,7 +18,9 @@ class FunctionReadDirectory : public FunctionBase<
friend FunctionBase;
DomDocumentCache::document_ptr constructDocument(
- boost::filesystem::path) const;
+ const FilesystemContext&,
+ boost::filesystem::path
+ ) const;
};
diff --git a/src/function/read_file.cc b/src/function/read_file.cc
index 42cb4a4..3718f04 100644
--- a/src/function/read_file.cc
+++ b/src/function/read_file.cc
@@ -60,7 +60,9 @@ boost::optional<std::string> readPlainFile(
namespace InputXSLT {
DomDocumentCache::document_ptr FunctionReadFile::constructDocument(
- boost::filesystem::path filePath) const {
+ const FilesystemContext&,
+ boost::filesystem::path filePath
+) const {
DomDocumentCache::document_ptr domDocument(
DomDocumentCache::createDocument("content")
);
diff --git a/src/function/read_file.h b/src/function/read_file.h
index b26bc6a..e5233e7 100644
--- a/src/function/read_file.h
+++ b/src/function/read_file.h
@@ -18,7 +18,9 @@ class FunctionReadFile : public FunctionBase<
friend FunctionBase;
DomDocumentCache::document_ptr constructDocument(
- boost::filesystem::path) const;
+ const FilesystemContext&,
+ boost::filesystem::path
+ ) const;
};
diff --git a/src/function/transform.cc b/src/function/transform.cc
index 7eab3fd..9bd2dae 100644
--- a/src/function/transform.cc
+++ b/src/function/transform.cc
@@ -10,8 +10,9 @@
namespace InputXSLT {
DomDocumentCache::document_ptr FunctionTransform::constructDocument(
- xalan::XSLTInputSource inputSource,
- xalan::XSLTInputSource transformationSource
+ const FilesystemContext&,
+ xalan::XSLTInputSource inputSource,
+ xalan::XSLTInputSource transformationSource
) const {
DomDocumentCache::document_ptr domDocument(
DomDocumentCache::createDocument("content")
diff --git a/src/function/transform.h b/src/function/transform.h
index 48f5c89..6c8c05d 100644
--- a/src/function/transform.h
+++ b/src/function/transform.h
@@ -19,6 +19,7 @@ class FunctionTransform : public FunctionBase<
friend FunctionBase;
DomDocumentCache::document_ptr constructDocument(
+ const FilesystemContext&,
xalan::XSLTInputSource,
xalan::XSLTInputSource
) const;
diff --git a/src/function/write_file.cc b/src/function/write_file.cc
index 70412d7..db9eea5 100644
--- a/src/function/write_file.cc
+++ b/src/function/write_file.cc
@@ -59,8 +59,9 @@ bool serializeNodeToFile(
namespace InputXSLT {
DomDocumentCache::document_ptr FunctionWriteFile::constructDocument(
- boost::filesystem::path filePath,
- xalan::XalanNode* const contentNode
+ const FilesystemContext&,
+ boost::filesystem::path filePath,
+ xalan::XalanNode* const contentNode
) const {
DomDocumentCache::document_ptr domDocument(
DomDocumentCache::createDocument("content")
diff --git a/src/function/write_file.h b/src/function/write_file.h
index 723865e..df05f95 100644
--- a/src/function/write_file.h
+++ b/src/function/write_file.h
@@ -17,6 +17,7 @@ class FunctionWriteFile : public FunctionBase<
friend FunctionBase;
DomDocumentCache::document_ptr constructDocument(
+ const FilesystemContext&,
boost::filesystem::path,
xalan::XalanNode* const
) const;
diff --git a/src/support/type/xobject_value.cc b/src/support/type/xobject_value.cc
index e457a69..2fe4f9f 100644
--- a/src/support/type/xobject_value.cc
+++ b/src/support/type/xobject_value.cc
@@ -15,10 +15,10 @@
namespace InputXSLT {
XObjectValue::XObjectValue(
- const boost::filesystem::path& path,
- const IncludeEntityResolver* resolver
+ const FilesystemContext* context,
+ const IncludeEntityResolver* resolver
):
- filesystem_context_(path),
+ filesystem_context_(context),
include_resolver_(resolver) { }
template <>
@@ -47,7 +47,7 @@ boost::filesystem::path XObjectValue::get<boost::filesystem::path>(
if ( auto resolvedPath = this->include_resolver_->resolve(rawPath) ) {
return *resolvedPath;
} else {
- return this->filesystem_context_.resolve(rawPath);
+ return this->filesystem_context_->resolve(rawPath);
}
}
@@ -89,7 +89,7 @@ xalan::XSLTInputSource XObjectValue::get<xalan::XSLTInputSource>(
source.setSystemId(
*XercesStringGuard<XMLCh>(
- this->filesystem_context_.getBase().string()
+ this->filesystem_context_->getBase().string()
)
);
diff --git a/src/support/type/xobject_value.h b/src/support/type/xobject_value.h
index cfc259d..53ceacc 100644
--- a/src/support/type/xobject_value.h
+++ b/src/support/type/xobject_value.h
@@ -12,7 +12,7 @@ namespace InputXSLT {
class XObjectValue {
public:
XObjectValue(
- const boost::filesystem::path&,
+ const FilesystemContext*,
const IncludeEntityResolver*
);
@@ -20,7 +20,7 @@ class XObjectValue {
Type get(const xalan::XObjectPtr&) const;
private:
- const FilesystemContext filesystem_context_;
+ const FilesystemContext* const filesystem_context_;
const IncludeEntityResolver* const include_resolver_;
};