diff options
Diffstat (limited to 'src/function/read_file.cc')
-rw-r--r-- | src/function/read_file.cc | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/src/function/read_file.cc b/src/function/read_file.cc index 19ecfc8..9e32f04 100644 --- a/src/function/read_file.cc +++ b/src/function/read_file.cc @@ -6,8 +6,8 @@ namespace InputXSLT { -FunctionReadFile::FunctionReadFile(const std::string& path): - path_(path) { } +FunctionReadFile::FunctionReadFile(const FilesystemContext& context): + fs_context_(context) { } xalan::XObjectPtr FunctionReadFile::execute( xalan::XPathExecutionContext& executionContext, @@ -20,19 +20,13 @@ xalan::XObjectPtr FunctionReadFile::execute( executionContext ); - generalError(executionContext, context, locator); + this->generalError(executionContext, context, locator); } - xalan::CharVectorType castHelper; - arguments[0]->str().transcode(castHelper); - - const std::string fileName( - castHelper.begin(), - castHelper.end() + boost::filesystem::ifstream file( + this->fs_context_.resolve(arguments[0]->str()) ); - boost::filesystem::ifstream file(this->path_ / fileName); - const std::string fileContent( (std::istreambuf_iterator<char>(file)), (std::istreambuf_iterator<char>()) |