diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/function/read_directory.cc | 10 | ||||
| -rw-r--r-- | src/function/read_file.cc | 10 | ||||
| -rw-r--r-- | src/function/read_xml_file.cc | 10 | ||||
| -rw-r--r-- | src/support/filesystem_context.cc | 10 | ||||
| -rw-r--r-- | src/support/filesystem_context.h | 3 | 
5 files changed, 13 insertions, 30 deletions
| diff --git a/src/function/read_directory.cc b/src/function/read_directory.cc index f8f99d6..09f8221 100644 --- a/src/function/read_directory.cc +++ b/src/function/read_directory.cc @@ -19,15 +19,7 @@ xalan::XObjectPtr FunctionReadDirectory::execute(  	const xalan::XObjectPtr argument,  	const xalan::Locator* locator  ) const { -	const FilesystemContext fs_context( -		boost::filesystem::path( -			*XercesStringGuard<char>( -				xercesc::XMLString::transcode( -					locator->getSystemId() + 7 -				) -			) -		).parent_path().string() -	); +	const FilesystemContext fs_context(locator);  	const boost::filesystem::path directoryPath(  		fs_context.resolve(argument->str()) diff --git a/src/function/read_file.cc b/src/function/read_file.cc index 633559e..8fcc04b 100644 --- a/src/function/read_file.cc +++ b/src/function/read_file.cc @@ -34,15 +34,7 @@ xalan::XObjectPtr FunctionReadFile::execute(  	const xalan::XObjectPtr argument,  	const xalan::Locator* locator  ) const { -	const FilesystemContext fs_context( -		boost::filesystem::path( -			*XercesStringGuard<char>( -				xercesc::XMLString::transcode( -					locator->getSystemId() + 7 -				) -			) -		).parent_path().string() -	); +	const FilesystemContext fs_context(locator);  	const boost::filesystem::path filePath(  		fs_context.resolve(argument->str()) diff --git a/src/function/read_xml_file.cc b/src/function/read_xml_file.cc index dc98fc7..0fa21fe 100644 --- a/src/function/read_xml_file.cc +++ b/src/function/read_xml_file.cc @@ -40,15 +40,7 @@ xalan::XObjectPtr FunctionReadXmlFile::execute(  	const xalan::XObjectPtr argument,  	const xalan::Locator* locator  ) const { -	const FilesystemContext fs_context( -		boost::filesystem::path( -			*XercesStringGuard<char>( -				xercesc::XMLString::transcode( -					locator->getSystemId() + 7 -				) -			) -		).parent_path().string() -	); +	const FilesystemContext fs_context(locator);  	const boost::filesystem::path filePath(  		fs_context.resolve(argument->str()) diff --git a/src/support/filesystem_context.cc b/src/support/filesystem_context.cc index d3caf88..32646be 100644 --- a/src/support/filesystem_context.cc +++ b/src/support/filesystem_context.cc @@ -1,5 +1,7 @@  #include "filesystem_context.h" +#include "support/xerces_string_guard.h" +  namespace {  inline std::string xalanToString(const xalan::XalanDOMString& text) { @@ -16,8 +18,12 @@ inline std::string xalanToString(const xalan::XalanDOMString& text) {  namespace InputXSLT { -FilesystemContext::FilesystemContext(const std::string& path): -	path_(canonical(boost::filesystem::path(path))) { } +FilesystemContext::FilesystemContext(const xalan::Locator* locator): +	path_(boost::filesystem::canonical( +		boost::filesystem::path( +			*XercesStringGuard<char>(locator->getSystemId()) + 7 +		).parent_path().string() +	)) { }  boost::filesystem::path FilesystemContext::resolve(  	const std::string& path) const { diff --git a/src/support/filesystem_context.h b/src/support/filesystem_context.h index cb3edd4..f743c89 100644 --- a/src/support/filesystem_context.h +++ b/src/support/filesystem_context.h @@ -2,6 +2,7 @@  #define INPUTXSLT_SRC_SUPPORT_FILESYSTEM_CONTEXT_H_  #include <xalanc/XalanDOM/XalanDOMString.hpp> +#include <xalanc/XPath/Function.hpp>  #include "boost/filesystem.hpp" @@ -14,7 +15,7 @@ namespace InputXSLT {  class FilesystemContext {  	public: -		explicit FilesystemContext(const std::string&); +		explicit FilesystemContext(const xalan::Locator*);  		boost::filesystem::path resolve(const std::string&) const;  		boost::filesystem::path resolve(const xalan::XalanDOMString&) const; | 
