Provide a build option to use the std::filesystem::path in place of log4cxx::File
diff --git a/src/cmake/boost-fallback/boost-fallback.cmake b/src/cmake/boost-fallback/boost-fallback.cmake
index ef78fd0..26609bd 100644
--- a/src/cmake/boost-fallback/boost-fallback.cmake
+++ b/src/cmake/boost-fallback/boost-fallback.cmake
@@ -12,7 +12,6 @@
"${CMAKE_CURRENT_LIST_DIR}/test-stdexpfilesystem.cpp")
# Check for standard headers that we need, fall back to boost if they're not found
-set(NAMESPACE_ALIAS ${LOG4CXX_NS})
option(PREFER_BOOST "Prefer Boost over std:: equivalents" OFF)
if( ${PREFER_BOOST} OR NOT ( ${STD_FILESYSTEM_FOUND} OR ${STD_EXPERIMENTAL_FILESYSTEM_FOUND} ) )
diff --git a/src/cmake/boost-fallback/boost-std-configuration.h.cmake b/src/cmake/boost-fallback/boost-std-configuration.h.cmake
deleted file mode 100644
index a56b21f..0000000
--- a/src/cmake/boost-fallback/boost-std-configuration.h.cmake
+++ /dev/null
@@ -1,31 +0,0 @@
-#ifndef BOOST_STD_CONFIGURATION_H
-#define BOOST_STD_CONFIGURATION_H
-
-#cmakedefine01 STD_FILESYSTEM_FOUND
-#cmakedefine01 Boost_FILESYSTEM_FOUND
-#cmakedefine01 STD_EXPERIMENTAL_FILESYSTEM_FOUND
-
-#if STD_FILESYSTEM_FOUND
-#include <filesystem>
-namespace ${NAMESPACE_ALIAS} {
-namespace filesystem {
- typedef std::filesystem::path path;
-}
-}
-#elif STD_EXPERIMENTAL_FILESYSTEM_FOUND
-#include <experimental/filesystem>
-namespace ${NAMESPACE_ALIAS} {
-namespace filesystem {
- typedef std::experimental::filesystem::path path;
-}
-}
-#elif Boost_FILESYSTEM_FOUND
-#include <boost/filesystem.hpp>
-namespace ${NAMESPACE_ALIAS} {
-namespace filesystem {
- typedef boost::filesystem::path path;
-}
-}
-#endif
-
-#endif /* BOOST_STD_CONFIGURATION_H */
diff --git a/src/examples/cpp/com/foo/config3.cpp b/src/examples/cpp/com/foo/config3.cpp
index c980248..163031c 100644
--- a/src/examples/cpp/com/foo/config3.cpp
+++ b/src/examples/cpp/com/foo/config3.cpp
@@ -126,15 +126,15 @@
int i = 0;
for (; extension[i]; ++i) {
File current_working_dir_candidate(baseName + extension[i]);
- if (current_working_dir_candidate.exists(pool)) {
- DefaultConfigurator::setConfigurationFileName(current_working_dir_candidate.getPath());
+ if (exists(pool, current_working_dir_candidate)) {
+ DefaultConfigurator::setConfigurationFileName(getPath(current_working_dir_candidate));
DefaultConfigurator::setConfigurationWatchSeconds(5);
break;
}
if (!altPrefix.empty()) {
File alt_dir_candidate(altPrefix + baseName + extension[i]);
- if (alt_dir_candidate.exists(pool)) {
- DefaultConfigurator::setConfigurationFileName(alt_dir_candidate.getPath());
+ if (exists(pool, alt_dir_candidate)) {
+ DefaultConfigurator::setConfigurationFileName(getPath(alt_dir_candidate));
DefaultConfigurator::setConfigurationWatchSeconds(5);
break;
}
diff --git a/src/main/cpp/defaultconfigurator.cpp b/src/main/cpp/defaultconfigurator.cpp
index 25ab569..51b9ae5 100644
--- a/src/main/cpp/defaultconfigurator.cpp
+++ b/src/main/cpp/defaultconfigurator.cpp
@@ -75,7 +75,7 @@
LogString debugMsg = LOG4CXX_STR("Checking file ");
debugMsg.append(names[i]);
LogLog::debug(debugMsg);
- if (candidate.exists(pool))
+ if (exists(pool, candidate))
{
configuration = candidate;
break;
@@ -84,13 +84,13 @@
}
else
{
- configuration.setPath(configurationFileName);
+ configuration = configurationFileName;
}
- if (configuration.exists(pool))
+ if (exists(pool, configuration))
{
LogString msg(LOG4CXX_STR("Using configuration file ["));
- msg += configuration.getPath();
+ msg += getPath(configuration);
msg += LOG4CXX_STR("] for automatic log4cxx configuration");
LogLog::debug(msg);
@@ -180,7 +180,7 @@
LogString debugMsg = LOG4CXX_STR("Checking file ");
debugMsg.append(canidate_str);
LogLog::debug(debugMsg);
- if (candidate.exists(pool))
+ if (exists(pool, candidate))
{
LOG4CXX_NS::spi::ConfigurationStatus configStatus = tryLoadFile(canidate_str);
if( configStatus == LOG4CXX_NS::spi::ConfigurationStatus::Configured ){
diff --git a/src/main/cpp/domconfigurator.cpp b/src/main/cpp/domconfigurator.cpp
index 186100c..3823316 100644
--- a/src/main/cpp/domconfigurator.cpp
+++ b/src/main/cpp/domconfigurator.cpp
@@ -782,7 +782,7 @@
repository1->setConfigured(true);
m_priv->repository = repository1;
LogString msg(LOG4CXX_STR("DOMConfigurator configuring file "));
- msg.append(filename.getPath());
+ msg.append(getPath(filename));
msg.append(LOG4CXX_STR("..."));
LogLog::debug(msg);
@@ -791,7 +791,7 @@
Pool p;
apr_file_t* fd;
- log4cxx_status_t rv = filename.open(&fd, APR_READ, APR_OS_DEFAULT, p);
+ log4cxx_status_t rv = openFile(filename , &fd, APR_READ, APR_OS_DEFAULT, p);
if (rv != APR_SUCCESS)
{
@@ -799,7 +799,7 @@
// what the PropertyConfigurator does
IOException io(rv);
LogString msg2(LOG4CXX_STR("Could not read configuration file ["));
- msg2.append(filename.getPath());
+ msg2.append(getPath(filename));
msg2.append(LOG4CXX_STR("]. "));
LOG4CXX_DECODE_CHAR(msg, io.what());
msg2.append(msg);
@@ -812,7 +812,7 @@
apr_xml_doc* doc = NULL;
LogString debugMsg = LOG4CXX_STR("Loading configuration file [")
- + filename.getPath() + LOG4CXX_STR("].");
+ + getPath(filename) + LOG4CXX_STR("].");
LogLog::debug(debugMsg);
rv = apr_xml_parse_file(p.getAPRPool(), &parser, &doc, fd, 2000);
@@ -822,7 +822,7 @@
char errbuf[2000];
char errbufXML[2000];
LogString msg2(LOG4CXX_STR("Error parsing file ["));
- msg2.append(filename.getPath());
+ msg2.append(getPath(filename));
msg2.append(LOG4CXX_STR("], "));
apr_strerror(rv, errbuf, sizeof(errbuf));
LOG4CXX_DECODE_CHAR(lerrbuf, std::string(errbuf));
diff --git a/src/main/cpp/file.cpp b/src/main/cpp/file.cpp
index 48512cc..5e04383 100644
--- a/src/main/cpp/file.cpp
+++ b/src/main/cpp/file.cpp
@@ -15,12 +15,180 @@
* limitations under the License.
*/
-#include <log4cxx/logstring.h>
#include <log4cxx/file.h>
#include <apr_file_io.h>
#include <apr_file_info.h>
#include <log4cxx/helpers/transcoder.h>
#include <log4cxx/helpers/pool.h>
+
+namespace LOG4CXX_NS
+{
+
+template<class S>
+static LogString decodeLS(const S* src)
+{
+ LogString dst;
+
+ if (src != 0)
+ {
+ helpers::Transcoder::decode(src, dst);
+ }
+
+ return dst;
+}
+
+template<class S>
+static LogString decodeLS(const std::basic_string<S>& src)
+{
+ LogString dst;
+ helpers::Transcoder::decode(src, dst);
+ return dst;
+}
+
+char* getPath(helpers::Pool& p, const File& f)
+{
+ int style = APR_FILEPATH_ENCODING_UNKNOWN;
+ apr_filepath_encoding(&style, p.getAPRPool());
+ char* retval = NULL;
+
+ if (style == APR_FILEPATH_ENCODING_UTF8)
+ {
+ retval = helpers::Transcoder::encodeUTF8(getPath(f), p);
+ }
+ else
+ {
+ retval = helpers::Transcoder::encode(getPath(f), p);
+ }
+
+ return retval;
+}
+
+char* convertBackSlashes(char* src)
+{
+ for (char* c = src; *c != 0; c++)
+ {
+ if (*c == '\\')
+ {
+ *c = '/';
+ }
+ }
+
+ return src;
+}
+
+std::vector<LogString> getFileList(helpers::Pool& p, const File& dir)
+{
+ apr_dir_t* dir;
+ apr_finfo_t entry;
+ std::vector<LogString> filenames;
+
+ apr_status_t stat = apr_dir_open(&dir,
+ convertBackSlashes(getPath(p, dir)),
+ p.getAPRPool());
+
+ if (stat == APR_SUCCESS)
+ {
+ int style = APR_FILEPATH_ENCODING_UNKNOWN;
+ apr_filepath_encoding(&style, p.getAPRPool());
+ stat = apr_dir_read(&entry, APR_FINFO_DIRENT, dir);
+
+ while (stat == APR_SUCCESS)
+ {
+ if (entry.name != NULL)
+ {
+ LogString filename;
+
+ if (style == APR_FILEPATH_ENCODING_UTF8)
+ {
+ helpers::Transcoder::decodeUTF8(entry.name, filename);
+ }
+ else
+ {
+ helpers::Transcoder::decode(entry.name, filename);
+ }
+
+ filenames.push_back(filename);
+ }
+
+ stat = apr_dir_read(&entry, APR_FINFO_DIRENT, dir);
+ }
+
+ stat = apr_dir_close(dir);
+ }
+
+ return filenames;
+}
+
+} // namespace LOG4CXX_NS
+
+#if LOG4CXX_FILE_IS_FILESYSTEM_PATH
+
+namespace LOG4CXX_NS
+{
+
+bool deleteFile(helpers::Pool&, const File& f)
+{
+ FileErrorCode ec;
+ return remove(f, ec);
+}
+
+LogString getPath(const File& f)
+{
+#if LOG4CXX_LOGCHAR_IS_UTF8
+ return f.string();
+#elif LOG4CXX_LOGCHAR_IS_WCHAR_T
+ return f.wstring();
+#else
+ return decodeLS(f.wstring());
+#endif
+}
+
+LogString getParent(helpers::Pool&, const File& f)
+{
+ LogString result;
+ if (f.has_parent_path())
+ result = getPath(f.parent_path());
+ return result;
+}
+
+log4cxx_time_t lastModified(helpers::Pool&, const File& f)
+{
+ log4cxx_time_t result = 0;
+ FileErrorCode ec;
+ auto ftime = last_write_time(f, ec);
+ if (!ec)
+ {
+ result = std::chrono::system_clock::to_time_t(clock_cast<std::chrono::system_clock>(ftime));
+ }
+ return result;
+}
+
+size_t length(helpers::Pool&, const File& f)
+{
+ size_t result = 0;
+ FileErrorCode ec;
+ auto fsize = file_size(f, ec);
+ if (!ec)
+ {
+ result = static_cast<size_t>(fsize);
+ }
+ return result;
+}
+
+bool mkdirs(helpers::Pool&, const File& f)
+{
+ FileErrorCode ec;
+ return create_directories(f, ec);
+}
+
+log4cxx_status_t openFile(const File& f, apr_file_t** file, int flags, int perm, helpers::Pool& p)
+{
+ return apr_file_open(file, getPath(p, f), flags, perm, p.getAPRPool());
+}
+
+} // namespace LOG4CXX_NS
+
+#else // !LOG4CXX_FILE_IS_FILESYSTEM_PATH
#include <assert.h>
#include <log4cxx/helpers/exception.h>
@@ -51,28 +219,6 @@
{
}
-template<class S>
-static LogString decodeLS(const S* src)
-{
- LogString dst;
-
- if (src != 0)
- {
- Transcoder::decode(src, dst);
- }
-
- return dst;
-}
-
-template<class S>
-static LogString decodeLS(const std::basic_string<S>& src)
-{
- LogString dst;
- Transcoder::decode(src, dst);
- return dst;
-}
-
-
File::File(const std::string& name)
#if LOG4CXX_LOGCHAR_IS_UTF8
: m_priv(std::make_unique<FilePrivate>(name))
@@ -148,6 +294,12 @@
return *this;
}
+File& File::operator=(const LogString& newName)
+{
+ m_priv->path.assign(newName);
+ return *this;
+}
+
File::~File()
{
@@ -184,20 +336,7 @@
char* File::getPath(Pool& p) const
{
- int style = APR_FILEPATH_ENCODING_UNKNOWN;
- apr_filepath_encoding(&style, p.getAPRPool());
- char* retval = NULL;
-
- if (style == APR_FILEPATH_ENCODING_UTF8)
- {
- retval = Transcoder::encodeUTF8(m_priv->path, p);
- }
- else
- {
- retval = Transcoder::encode(m_priv->path, p);
- }
-
- return retval;
+ return ::getPath(p, *this);
}
log4cxx_status_t File::open(apr_file_t** file, int flags,
@@ -277,47 +416,8 @@
std::vector<LogString> File::list(Pool& p) const
{
- apr_dir_t* dir;
- apr_finfo_t entry;
- std::vector<LogString> filenames;
-
- apr_status_t stat = apr_dir_open(&dir,
- convertBackSlashes(getPath(p)),
- p.getAPRPool());
-
- if (stat == APR_SUCCESS)
- {
- int style = APR_FILEPATH_ENCODING_UNKNOWN;
- apr_filepath_encoding(&style, p.getAPRPool());
- stat = apr_dir_read(&entry, APR_FINFO_DIRENT, dir);
-
- while (stat == APR_SUCCESS)
- {
- if (entry.name != NULL)
- {
- LogString filename;
-
- if (style == APR_FILEPATH_ENCODING_UTF8)
- {
- Transcoder::decodeUTF8(entry.name, filename);
- }
- else
- {
- Transcoder::decode(entry.name, filename);
- }
-
- filenames.push_back(filename);
- }
-
- stat = apr_dir_read(&entry, APR_FINFO_DIRENT, dir);
- }
-
- stat = apr_dir_close(dir);
- }
-
- return filenames;
+ return getFileList(p, *this);
}
-
LogString File::getParent(Pool&) const
{
LogString::size_type slashPos = m_priv->path.rfind(LOG4CXX_STR('/'));
@@ -359,3 +459,5 @@
bool File::getAutoDelete() const{
return m_priv->autoDelete;
}
+
+#endif // !LOG4CXX_FILE_IS_FILESYSTEM_PATH
diff --git a/src/main/cpp/fileappender.cpp b/src/main/cpp/fileappender.cpp
index 120c3de..e2264ea 100644
--- a/src/main/cpp/fileappender.cpp
+++ b/src/main/cpp/fileappender.cpp
@@ -287,9 +287,8 @@
//
if (append1)
{
- File outFile;
- outFile.setPath(filename);
- writeBOM = !outFile.exists(p);
+ File outFile(filename);
+ writeBOM = !exists(p, outFile);
}
else
{
@@ -305,14 +304,11 @@
}
catch (IOException&)
{
- LogString parentName = File(filename).getParent(p);
-
+ auto parentName = getParent(p, File(filename));
if (!parentName.empty())
{
- File parentDir;
- parentDir.setPath(parentName);
-
- if (!parentDir.exists(p) && parentDir.mkdirs(p))
+ File parentDir(parentName);
+ if (!exists(p, parentDir) && mkdirs(p, parentDir))
{
outStream = OutputStreamPtr(new FileOutputStream(filename, append1));
}
diff --git a/src/main/cpp/fileinputstream.cpp b/src/main/cpp/fileinputstream.cpp
index c378899..e3045d9 100644
--- a/src/main/cpp/fileinputstream.cpp
+++ b/src/main/cpp/fileinputstream.cpp
@@ -57,7 +57,7 @@
{
apr_fileperms_t perm = APR_OS_DEFAULT;
apr_int32_t flags = APR_READ;
- apr_status_t stat = File(filename).open(&m_priv->fileptr, flags, perm, m_priv->pool);
+ apr_status_t stat = openFile(File(filename) , &m_priv->fileptr, flags, perm, m_priv->pool);
if (stat != APR_SUCCESS)
{
@@ -71,7 +71,7 @@
{
apr_fileperms_t perm = APR_OS_DEFAULT;
apr_int32_t flags = APR_READ;
- apr_status_t stat = aFile.open(&m_priv->fileptr, flags, perm, m_priv->pool);
+ apr_status_t stat = openFile(aFile, &m_priv->fileptr, flags, perm, m_priv->pool);
if (stat != APR_SUCCESS)
{
diff --git a/src/main/cpp/fileoutputstream.cpp b/src/main/cpp/fileoutputstream.cpp
index 5becde6..805c95f 100644
--- a/src/main/cpp/fileoutputstream.cpp
+++ b/src/main/cpp/fileoutputstream.cpp
@@ -66,10 +66,9 @@
flags |= APR_TRUNCATE;
}
- File fn;
- fn.setPath(filename);
+ File fn(filename);
apr_file_t* fileptr = 0;
- apr_status_t stat = fn.open(&fileptr, flags, perm, pool);
+ apr_status_t stat = openFile(fn, &fileptr, flags, perm, pool);
if (stat != APR_SUCCESS)
{
diff --git a/src/main/cpp/filerenameaction.cpp b/src/main/cpp/filerenameaction.cpp
index c0d2d3e..ef3b5ba 100644
--- a/src/main/cpp/filerenameaction.cpp
+++ b/src/main/cpp/filerenameaction.cpp
@@ -48,5 +48,11 @@
bool FileRenameAction::execute(LOG4CXX_NS::helpers::Pool& pool1) const
{
+#if LOG4CXX_FILE_IS_FILESYSTEM_PATH
+ FileErrorCode ec;
+ rename(priv->source, priv->destination, ec);
+ return !ec;
+#else
return priv->source.renameTo(priv->destination, pool1);
+#endif // LOG4CXX_FILE_IS_FILESYSTEM_PATH
}
diff --git a/src/main/cpp/filewatchdog.cpp b/src/main/cpp/filewatchdog.cpp
index c31363b..8c1120c 100644
--- a/src/main/cpp/filewatchdog.cpp
+++ b/src/main/cpp/filewatchdog.cpp
@@ -90,24 +90,24 @@
void FileWatchdog::checkAndConfigure()
{
LogString msg(LOG4CXX_STR("Checking ["));
- msg += m_priv->file.getPath();
+ msg += getPath(m_priv->file);
msg += LOG4CXX_STR("]");
LogLog::debug(msg);
Pool pool1;
- if (!m_priv->file.exists(pool1))
+ if (!exists(pool1, m_priv->file))
{
if (!m_priv->warnedAlready)
{
LogLog::debug(((LogString) LOG4CXX_STR("["))
- + m_priv->file.getPath()
+ + getPath(m_priv->file)
+ LOG4CXX_STR("] does not exist."));
m_priv->warnedAlready = true;
}
}
else
{
- auto thisMod = m_priv->file.lastModified(pool1);
+ auto thisMod = lastModified(pool1, m_priv->file);
if (thisMod > m_priv->lastModif)
{
@@ -121,7 +121,7 @@
void FileWatchdog::run()
{
LogString msg(LOG4CXX_STR("Checking ["));
- msg += m_priv->file.getPath();
+ msg += getPath(m_priv->file);
msg += LOG4CXX_STR("] at ");
StringHelper::toString((int)m_priv->delay, m_priv->pool, msg);
msg += LOG4CXX_STR(" ms interval");
@@ -136,7 +136,7 @@
}
LogString msg2(LOG4CXX_STR("Stop checking ["));
- msg2 += m_priv->file.getPath();
+ msg2 += getPath(m_priv->file);
msg2 += LOG4CXX_STR("]");
LogLog::debug(msg2);
}
diff --git a/src/main/cpp/fixedwindowrollingpolicy.cpp b/src/main/cpp/fixedwindowrollingpolicy.cpp
index 21aa9cf..194f75b 100644
--- a/src/main/cpp/fixedwindowrollingpolicy.cpp
+++ b/src/main/cpp/fixedwindowrollingpolicy.cpp
@@ -191,8 +191,8 @@
if(getCreateIntermediateDirectories()){
File compressedFile(compressedName);
- File compressedParent (compressedFile.getParent(pool));
- compressedParent.mkdirs(pool);
+ File compressedParent(getParent(pool, compressedFile));
+ mkdirs(pool, compressedParent);
}
if (StringHelper::endsWith(renameTo, LOG4CXX_STR(".gz")))
@@ -276,32 +276,29 @@
for (int i = lowIndex; i <= highIndex; i++)
{
- File toRenameCompressed;
- toRenameCompressed.setPath(lowFilename);
- File toRenameBase;
- toRenameBase.setPath(lowFilename.substr(0, lowFilename.length() - suffixLength));
+ File toRenameCompressed(lowFilename);
+ File toRenameBase(lowFilename.substr(0, lowFilename.length() - suffixLength));
File* toRename = &toRenameCompressed;
bool isBase = false;
- bool exists = toRenameCompressed.exists(p);
+ bool found = exists(p, toRenameCompressed);
if (suffixLength > 0)
{
- if (exists)
+ if (found)
{
- if (toRenameBase.exists(p))
+ if (exists(p, toRenameBase))
{
- toRenameBase.deleteFile(p);
+ deleteFile(p, toRenameBase);
}
}
else
{
- toRename = &toRenameBase;
- exists = toRenameBase.exists(p);
+ found = exists(p, toRenameBase);
isBase = true;
}
}
- if (exists)
+ if (found)
{
//
// if at upper index then
@@ -309,7 +306,7 @@
// if that fails then abandon purge
if (i == highIndex)
{
- if (!toRename->deleteFile(p))
+ if (!deleteFile(p, *toRename))
{
return false;
}
diff --git a/src/main/cpp/gzcompressaction.cpp b/src/main/cpp/gzcompressaction.cpp
index bc07e13..9307f0f 100644
--- a/src/main/cpp/gzcompressaction.cpp
+++ b/src/main/cpp/gzcompressaction.cpp
@@ -56,7 +56,7 @@
bool GZCompressAction::execute(LOG4CXX_NS::helpers::Pool& p) const
{
- if (priv->source.exists(p))
+ if (exists(p, priv->source))
{
apr_pool_t* aprpool = p.getAPRPool();
apr_procattr_t* attr;
@@ -87,7 +87,7 @@
apr_file_t* child_out;
apr_int32_t flags = APR_FOPEN_READ | APR_FOPEN_WRITE |
APR_FOPEN_CREATE | APR_FOPEN_TRUNCATE;
- stat = priv->destination.open(&child_out, flags, APR_OS_DEFAULT, p);
+ stat = openFile(priv->destination, &child_out, flags, APR_OS_DEFAULT, p);
if (stat != APR_SUCCESS)
{
@@ -117,14 +117,12 @@
}
}
- priv->destination.setAutoDelete(true);
-
const char** args = (const char**)
apr_palloc(aprpool, 4 * sizeof(*args));
int i = 0;
args[i++] = "gzip";
args[i++] = "-c";
- args[i++] = Transcoder::encode(priv->source.getPath(), p);
+ args[i++] = Transcoder::encode(getPath(priv->source), p);
args[i++] = NULL;
apr_proc_t pid;
@@ -132,8 +130,10 @@
if (stat != APR_SUCCESS && priv->throwIOExceptionOnForkFailure)
{
+ deleteFile(p, priv->destination);
throw IOException(stat);
- }else if(stat != APR_SUCCESS && !priv->throwIOExceptionOnForkFailure)
+ }
+ else if(stat != APR_SUCCESS && !priv->throwIOExceptionOnForkFailure)
{
/* If we fail here (to create the gzip child process),
* skip the compression and consider the rotation to be
@@ -149,6 +149,7 @@
{
LogLog::warn(LOG4CXX_STR("Failed to close abandoned .gz file; ignoring"));
}
+ deleteFile(p, priv->destination);
return true;
}
@@ -160,11 +161,9 @@
throw IOException(stat);
}
- priv->destination.setAutoDelete(false);
-
if (priv->deleteSource)
{
- priv->source.deleteFile(p);
+ deleteFile(p, priv->source);
}
return true;
diff --git a/src/main/cpp/multiprocessrollingfileappender.cpp b/src/main/cpp/multiprocessrollingfileappender.cpp
index 9386d3a..0f1a14a 100644
--- a/src/main/cpp/multiprocessrollingfileappender.cpp
+++ b/src/main/cpp/multiprocessrollingfileappender.cpp
@@ -34,7 +34,7 @@
#include <log4cxx/helpers/transcoder.h>
#include <log4cxx/private/fileappender_priv.h>
#include <log4cxx/rolling/timebasedrollingpolicy.h>
-#include <log4cxx/private/boost-std-configuration.h>
+#include <log4cxx/helpers/filesystem.h>
#include <mutex>
using namespace LOG4CXX_NS;
@@ -150,7 +150,7 @@
if (getAppend())
{
- _priv->fileLength = activeFile.length(p);
+ _priv->fileLength = length(p, activeFile);
}
else
{
@@ -347,7 +347,7 @@
{
if (rollover1->getAppend())
{
- _priv->fileLength = File(rollover1->getActiveFileName()).length(p);
+ _priv->fileLength = length(p, File(rollover1->getActiveFileName()));
}
else
{
@@ -408,7 +408,7 @@
{
if (rollover1->getAppend())
{
- _priv->fileLength = File(rollover1->getActiveFileName()).length(p);
+ _priv->fileLength = length(p, File(rollover1->getActiveFileName()));
}
else
{
@@ -464,7 +464,7 @@
WriterPtr newWriter(createWriter(os));
setFile(getFile());
setWriter(newWriter);
- _priv->fileLength = File(getFile()).length(p);
+ _priv->fileLength = length(p, File(getFile()));
writeHeader(p);
}
@@ -644,7 +644,7 @@
if (rfa != 0)
{
- rfa->setFileLength(File(rfa->getFile()).length(p));
+ rfa->setFileLength(length(p, File(rfa->getFile())));
}
}
diff --git a/src/main/cpp/optionconverter.cpp b/src/main/cpp/optionconverter.cpp
index cfd1af5..25989b1 100644
--- a/src/main/cpp/optionconverter.cpp
+++ b/src/main/cpp/optionconverter.cpp
@@ -412,7 +412,7 @@
ConfiguratorPtr configurator;
LogString clazz = _clazz;
- LogString filename(configFileName.getPath());
+ LogString filename(getPath(configFileName));
if (clazz.empty()
&& filename.length() > 4
diff --git a/src/main/cpp/propertyconfigurator.cpp b/src/main/cpp/propertyconfigurator.cpp
index 61f80fb..2d163d8 100644
--- a/src/main/cpp/propertyconfigurator.cpp
+++ b/src/main/cpp/propertyconfigurator.cpp
@@ -100,21 +100,21 @@
{
LOG4CXX_DECODE_CHAR(lsMsg, ex.what());
LogLog::error(((LogString) LOG4CXX_STR("Could not read configuration file ["))
- + configFileName.getPath() + LOG4CXX_STR("]: ") + lsMsg);
+ + getPath(configFileName) + LOG4CXX_STR("]: ") + lsMsg);
return spi::ConfigurationStatus::NotConfigured;
}
try
{
LogString debugMsg = LOG4CXX_STR("Loading configuration file [")
- + configFileName.getPath() + LOG4CXX_STR("].");
+ + getPath(configFileName) + LOG4CXX_STR("].");
LogLog::debug(debugMsg);
return doConfigure(props, hierarchy);
}
catch (const std::exception& ex)
{
LogLog::error(((LogString) LOG4CXX_STR("Could not parse configuration file ["))
- + configFileName.getPath() + LOG4CXX_STR("]: "), ex);
+ + getPath(configFileName) + LOG4CXX_STR("]: "), ex);
}
return spi::ConfigurationStatus::NotConfigured;
diff --git a/src/main/cpp/rollingfileappender.cpp b/src/main/cpp/rollingfileappender.cpp
index 9fa7149..1a9a824 100644
--- a/src/main/cpp/rollingfileappender.cpp
+++ b/src/main/cpp/rollingfileappender.cpp
@@ -261,12 +261,11 @@
}
}
- File activeFile;
- activeFile.setPath(getFile());
+ File activeFile(getFile());
if (getAppend())
{
- _priv->fileLength = activeFile.length(p);
+ _priv->fileLength = length(p, activeFile);
}
else
{
@@ -348,7 +347,7 @@
{
if (rollover1->getAppend())
{
- _priv->fileLength = File(rollover1->getActiveFileName()).length(p);
+ _priv->fileLength = length(p, File(rollover1->getActiveFileName()));
}
else
{
@@ -410,7 +409,7 @@
{
if (rollover1->getAppend())
{
- _priv->fileLength = File(rollover1->getActiveFileName()).length(p);
+ _priv->fileLength = length(p, File(rollover1->getActiveFileName()));
}
else
{
diff --git a/src/main/cpp/timebasedrollingpolicy.cpp b/src/main/cpp/timebasedrollingpolicy.cpp
index a8df8ee..1a4622c 100644
--- a/src/main/cpp/timebasedrollingpolicy.cpp
+++ b/src/main/cpp/timebasedrollingpolicy.cpp
@@ -28,7 +28,7 @@
#include <log4cxx/helpers/stringhelper.h>
#include <log4cxx/helpers/optionconverter.h>
#include <log4cxx/fileappender.h>
-#include <log4cxx/private/boost-std-configuration.h>
+#include <log4cxx/helpers/filesystem.h>
#include <iostream>
#include <apr_mmap.h>
@@ -369,7 +369,7 @@
File currentFile(currentActiveFile);
LogString buf;
- ObjectPtr obj = std::make_shared<Date>(currentFile.exists(pool) ? currentFile.lastModified(pool) : n);
+ ObjectPtr obj = std::make_shared<Date>(exists(pool, currentFile) ? lastModified(pool, currentFile) : n);
formatFileName(obj, buf, pool);
m_priv->lastFileName = buf;
@@ -441,8 +441,8 @@
if(getCreateIntermediateDirectories()){
File compressedFile(m_priv->lastFileName);
- File compressedParent (compressedFile.getParent(pool));
- compressedParent.mkdirs(pool);
+ File compressedParent (getParent(pool, compressedFile));
+ mkdirs(pool, compressedParent);
}
//
diff --git a/src/main/cpp/zipcompressaction.cpp b/src/main/cpp/zipcompressaction.cpp
index 2ba9e72..c08f826 100644
--- a/src/main/cpp/zipcompressaction.cpp
+++ b/src/main/cpp/zipcompressaction.cpp
@@ -54,7 +54,7 @@
bool ZipCompressAction::execute(LOG4CXX_NS::helpers::Pool& p) const
{
- if (!priv->source.exists(p))
+ if (!exists(p, priv->source))
{
return false;
}
@@ -104,13 +104,13 @@
args[i++] = "zip";
args[i++] = "-q";
- args[i++] = Transcoder::encode(priv->destination.getPath(), p);
- args[i++] = Transcoder::encode(priv->source.getPath(), p);
+ args[i++] = Transcoder::encode(getPath(priv->destination), p);
+ args[i++] = Transcoder::encode(getPath(priv->source), p);
args[i++] = NULL;
- if (priv->destination.exists(p))
+ if (exists(p, priv->destination))
{
- priv->destination.deleteFile(p);
+ deleteFile(p, priv->destination);
}
apr_proc_t pid;
@@ -143,7 +143,7 @@
if (priv->deleteSource)
{
- priv->source.deleteFile(p);
+ deleteFile(p, priv->source);
}
return true;
diff --git a/src/main/include/CMakeLists.txt b/src/main/include/CMakeLists.txt
index ff98ca2..0110894 100644
--- a/src/main/include/CMakeLists.txt
+++ b/src/main/include/CMakeLists.txt
@@ -103,6 +103,8 @@
set(LOG4CXX_USE_STANDARD_FORMAT 1)
endif()
+option(LOG4CXX_FILE_IS_FILESYSTEM_PATH "Change log4cxx::File interface to match std::filesystem::path" OFF)
+
# Configure log4cxx_private.h
set(LOG4CXX_CHARSET "utf-8" CACHE STRING "LogString characters, choice of utf-8 (default), ISO-8859-1, US-ASCII, EBCDIC, locale")
set_property(CACHE LOG4CXX_CHARSET PROPERTY STRINGS "utf-8" "ISO-8859-1" "US-ASCII" "EBCDIC" "locale")
@@ -192,10 +194,6 @@
@ONLY
)
list(APPEND GENERATED_HEADERS ${CMAKE_CURRENT_BINARY_DIR}/log4cxx/log4cxx.h)
-configure_file(${LOG4CXX_SOURCE_DIR}/src/cmake/boost-fallback/boost-std-configuration.h.cmake
- ${CMAKE_CURRENT_BINARY_DIR}/log4cxx/private/boost-std-configuration.h
-)
-list(APPEND GENERATED_HEADERS ${CMAKE_CURRENT_BINARY_DIR}/log4cxx/private/boost-std-configuration.h)
# A target for the convenience of working with headers in the IDE
file(GENERATE
diff --git a/src/main/include/log4cxx/file.h b/src/main/include/log4cxx/file.h
index ba28100..8170614 100644
--- a/src/main/include/log4cxx/file.h
+++ b/src/main/include/log4cxx/file.h
@@ -19,12 +19,39 @@
#define _LOG4CXX_FILE_H
#include <log4cxx/logstring.h>
+#include <log4cxx/helpers/pool.h>
+#include <vector>
extern "C" {
struct apr_file_t;
struct apr_finfo_t;
}
+#if LOG4CXX_FILE_IS_FILESYSTEM_PATH
+#include <log4cxx/helpers/filesystem.h>
+
+namespace LOG4CXX_NS
+{
+LOG4CXX_EXPORT bool deleteFile(helpers::Pool& p, const File& f);
+
+LOG4CXX_EXPORT LogString getPath(const File& f);
+
+LOG4CXX_EXPORT LogString getParent(helpers::Pool& p, const File& f);
+
+inline bool exists(helpers::Pool&, const File& f) { return exists(f); }
+
+LOG4CXX_EXPORT log4cxx_time_t lastModified(helpers::Pool& p, const File& f);
+
+LOG4CXX_EXPORT size_t length(helpers::Pool& pool, const File& f);
+
+LOG4CXX_EXPORT std::vector<LogString> getFileList(helpers::Pool& p, const File& dir);
+
+LOG4CXX_EXPORT bool mkdirs(helpers::Pool& p, const File& f);
+
+LOG4CXX_EXPORT log4cxx_status_t openFile(const File& f, apr_file_t** file, int flags, int perm, helpers::Pool& p);
+}
+#else // !LOG4CXX_FILE_IS_FILESYSTEM_PATH
+
namespace LOG4CXX_NS
{
@@ -88,6 +115,10 @@
*/
File& operator=(const File& src);
/**
+ * Change the path to \c newName.
+ */
+ File& operator=(const LogString& newName);
+ /**
* Destructor.
*/
~File();
@@ -189,7 +220,28 @@
static char* convertBackSlashes(char*);
char* getPath(helpers::Pool& p) const;
};
+
+inline bool deleteFile(helpers::Pool& p, const File& f) { return f.deleteFile(p); }
+
+inline LogString getPath(const File& f) { return f.getPath(); }
+
+inline LogString getParent(helpers::Pool& p, const File& f) { return f.getParent(p); }
+
+inline bool exists(helpers::Pool& p, const File& f) { return f.exists(p); }
+
+inline log4cxx_time_t lastModified(helpers::Pool& p, const File& f) { return f.lastModified(p); }
+
+inline size_t length(helpers::Pool& p, const File& f) { return f.length(p); }
+
+LOG4CXX_EXPORT std::vector<LogString> getFileList(helpers::Pool& p, const File& dir);
+
+inline bool mkdirs(helpers::Pool& p, const File& f) { return f.mkdirs(p); }
+
+inline log4cxx_status_t openFile(const File& f, apr_file_t** file, int flags, int perm, helpers::Pool& p)
+{ return f.open(file, flags, perm, p); }
+
} // namespace log4cxx
+#endif // LOG4CXX_FILE_IS_FILESYSTEM_PATH
#define LOG4CXX_FILE(name) LOG4CXX_NS::File(name)
diff --git a/src/main/include/log4cxx/helpers/fileoutputstream.h b/src/main/include/log4cxx/helpers/fileoutputstream.h
index 5806941..d813093 100644
--- a/src/main/include/log4cxx/helpers/fileoutputstream.h
+++ b/src/main/include/log4cxx/helpers/fileoutputstream.h
@@ -22,6 +22,7 @@
#include <log4cxx/file.h>
#include <log4cxx/helpers/pool.h>
+extern "C" { struct apr_file_t; }
namespace LOG4CXX_NS
{
diff --git a/src/main/include/log4cxx/helpers/filesystem.h b/src/main/include/log4cxx/helpers/filesystem.h
new file mode 100644
index 0000000..e7edf86
--- /dev/null
+++ b/src/main/include/log4cxx/helpers/filesystem.h
@@ -0,0 +1,38 @@
+#ifndef LOG4CXX_FILESYSTEM_HELPER_HDR_
+#define LOG4CXX_FILESYSTEM_HELPER_HDR_
+
+#include <log4cxx/log4cxx.h>
+
+#if STD_FILESYSTEM_FOUND
+#include <filesystem>
+namespace LOG4CXX_NS
+{
+namespace filesystem { using path = std::filesystem::path; }
+#if LOG4CXX_FILE_IS_FILESYSTEM_PATH
+using File = std::filesystem::path;
+using FileErrorCode = std::error_code;
+#endif
+}
+#elif STD_EXPERIMENTAL_FILESYSTEM_FOUND
+#include <experimental/filesystem>
+namespace LOG4CXX_NS
+{
+namespace filesystem { using path = std::experimental::filesystem::path; }
+#if LOG4CXX_FILE_IS_FILESYSTEM_PATH
+using File = std::experimental::filesystem::path;
+using FileErrorCode = std::error_code;
+#endif
+}
+#elif Boost_FILESYSTEM_FOUND
+#include <boost/filesystem.hpp>
+namespace LOG4CXX_NS
+{
+namespace filesystem { using path = boost::filesystem::path; }
+#if LOG4CXX_FILE_IS_FILESYSTEM_PATH
+using File = boost::filesystem::path;
+using FileErrorCode = boost::system::error_code;
+#endif
+}
+#endif
+
+#endif // LOG4CXX_FILESYSTEM_HELPER_HDR_
diff --git a/src/main/include/log4cxx/helpers/optionconverter.h b/src/main/include/log4cxx/helpers/optionconverter.h
index 3971e7e..4a416f3 100644
--- a/src/main/include/log4cxx/helpers/optionconverter.h
+++ b/src/main/include/log4cxx/helpers/optionconverter.h
@@ -18,13 +18,11 @@
#ifndef _LOG4CXX_HELPER_OPTION_CONVERTER_H
#define _LOG4CXX_HELPER_OPTION_CONVERTER_H
-#include <log4cxx/logstring.h>
-#include <log4cxx/helpers/object.h>
+#include <log4cxx/file.h>
namespace LOG4CXX_NS
{
class Level;
-class File;
typedef std::shared_ptr<Level> LevelPtr;
namespace spi
diff --git a/src/main/include/log4cxx/helpers/xml.h b/src/main/include/log4cxx/helpers/xml.h
index f2437e9..502a81b 100644
--- a/src/main/include/log4cxx/helpers/xml.h
+++ b/src/main/include/log4cxx/helpers/xml.h
@@ -19,12 +19,11 @@
#define _LOG4CXX_HELPERS_XML_H
#include <log4cxx/logstring.h>
-#include <log4cxx/helpers/object.h>
+#include <log4cxx/file.h>
#include <log4cxx/helpers/exception.h>
namespace LOG4CXX_NS
{
-class File;
namespace helpers
{
class XMLDOMNode;
diff --git a/src/main/include/log4cxx/log4cxx.h.in b/src/main/include/log4cxx/log4cxx.h.in
index 530bc82..32fb361 100644
--- a/src/main/include/log4cxx/log4cxx.h.in
+++ b/src/main/include/log4cxx/log4cxx.h.in
@@ -130,4 +130,9 @@
#define LOG4CXX_FORMAT_NS fmt
#endif
-#endif
+#cmakedefine01 STD_FILESYSTEM_FOUND
+#cmakedefine01 Boost_FILESYSTEM_FOUND
+#cmakedefine01 STD_EXPERIMENTAL_FILESYSTEM_FOUND
+#cmakedefine01 LOG4CXX_FILE_IS_FILESYSTEM_PATH
+
+#endif // LOG4CXX_LOG4CXX_H
diff --git a/src/main/include/log4cxx/rolling/filterbasedtriggeringpolicy.h b/src/main/include/log4cxx/rolling/filterbasedtriggeringpolicy.h
index de7b22f..92dce85 100644
--- a/src/main/include/log4cxx/rolling/filterbasedtriggeringpolicy.h
+++ b/src/main/include/log4cxx/rolling/filterbasedtriggeringpolicy.h
@@ -20,6 +20,7 @@
#include <log4cxx/rolling/triggeringpolicy.h>
#include <log4cxx/spi/filter.h>
+#include <log4cxx/file.h>
// Instantiate template pointer types passed as parameters
LOG4CXX_INSTANTIATE_EXPORTED_PTR(LOG4CXX_NS::spi::Filter);
@@ -27,8 +28,6 @@
namespace LOG4CXX_NS
{
-class File;
-
namespace helpers
{
class Pool;
diff --git a/src/main/include/log4cxx/rolling/manualtriggeringpolicy.h b/src/main/include/log4cxx/rolling/manualtriggeringpolicy.h
index 94962fc..ef26478 100644
--- a/src/main/include/log4cxx/rolling/manualtriggeringpolicy.h
+++ b/src/main/include/log4cxx/rolling/manualtriggeringpolicy.h
@@ -19,12 +19,11 @@
#define _LOG4CXX_ROLLING_MANUAL_TRIGGERING_POLICY_H
#include <log4cxx/rolling/triggeringpolicy.h>
+#include <log4cxx/file.h>
namespace LOG4CXX_NS
{
-class File;
-
namespace helpers
{
class Pool;
diff --git a/src/main/include/log4cxx/rolling/sizebasedtriggeringpolicy.h b/src/main/include/log4cxx/rolling/sizebasedtriggeringpolicy.h
index 63da270..4676569 100644
--- a/src/main/include/log4cxx/rolling/sizebasedtriggeringpolicy.h
+++ b/src/main/include/log4cxx/rolling/sizebasedtriggeringpolicy.h
@@ -19,12 +19,11 @@
#define _LOG4CXX_ROLLING_SIZE_BASED_TRIGGERING_POLICY_H
#include <log4cxx/rolling/triggeringpolicy.h>
+#include <log4cxx/file.h>
namespace LOG4CXX_NS
{
-class File;
-
namespace helpers
{
class Pool;
diff --git a/src/main/include/log4cxx/rolling/triggeringpolicy.h b/src/main/include/log4cxx/rolling/triggeringpolicy.h
index ac6b2db..93ccadc 100644
--- a/src/main/include/log4cxx/rolling/triggeringpolicy.h
+++ b/src/main/include/log4cxx/rolling/triggeringpolicy.h
@@ -27,8 +27,6 @@
namespace LOG4CXX_NS
{
-class File;
-
namespace rolling
{
diff --git a/src/main/include/log4cxx/spi/configurator.h b/src/main/include/log4cxx/spi/configurator.h
index 06e6be4..a4bbb2a 100644
--- a/src/main/include/log4cxx/spi/configurator.h
+++ b/src/main/include/log4cxx/spi/configurator.h
@@ -19,10 +19,10 @@
#define _LOG4CXX_SPI_CONFIGURATOR_H
#include <log4cxx/spi/loggerrepository.h>
+#include <log4cxx/file.h>
namespace LOG4CXX_NS
{
-class File;
namespace spi
{
diff --git a/src/test/cpp/autoconfiguretestcase.cpp b/src/test/cpp/autoconfiguretestcase.cpp
index e486727..77424cf 100644
--- a/src/test/cpp/autoconfiguretestcase.cpp
+++ b/src/test/cpp/autoconfiguretestcase.cpp
@@ -75,7 +75,7 @@
void copyPropertyFile()
{
- LOGUNIT_ASSERT(File(LOG4CXX_STR("input/autoConfigureTest.properties")).exists(m_pool));
+ LOGUNIT_ASSERT(exists(m_pool, File(LOG4CXX_STR("input/autoConfigureTest.properties"))));
LOGUNIT_ASSERT(apr_file_copy
( "input/autoConfigureTest.properties"
, "autoconfiguretestcase.properties"
@@ -85,7 +85,7 @@
DefaultConfigurator::setConfigurationFileName(m_configFile);
DefaultConfigurator::setConfigurationWatchSeconds(1);
- LOGUNIT_ASSERT(File(m_configFile).exists(m_pool));
+ LOGUNIT_ASSERT(exists(m_pool, File(m_configFile)));
}
void shutdown()
diff --git a/src/test/cpp/fileappendertest.cpp b/src/test/cpp/fileappendertest.cpp
index fb6e992..9020190 100644
--- a/src/test/cpp/fileappendertest.cpp
+++ b/src/test/cpp/fileappendertest.cpp
@@ -44,17 +44,17 @@
{
File newFile(LOG4CXX_STR("output/newdir/temp.log"));
Pool p;
- newFile.deleteFile(p);
+ deleteFile(p, newFile);
File newDir(LOG4CXX_STR("output/newdir"));
- newDir.deleteFile(p);
+ deleteFile(p, newDir);
FileAppenderPtr wa(new FileAppender());
wa->setFile(LOG4CXX_STR("output/newdir/temp.log"));
wa->setLayout(PatternLayoutPtr(new PatternLayout(LOG4CXX_STR("%m%n"))));
wa->activateOptions(p);
- LOGUNIT_ASSERT(File(LOG4CXX_STR("output/newdir/temp.log")).exists(p));
+ LOGUNIT_ASSERT(exists(p, File(LOG4CXX_STR("output/newdir/temp.log"))));
}
/**
diff --git a/src/test/cpp/fileappendertestcase.cpp b/src/test/cpp/fileappendertestcase.cpp
index 61910e6..1c833c2 100644
--- a/src/test/cpp/fileappendertestcase.cpp
+++ b/src/test/cpp/fileappendertestcase.cpp
@@ -61,7 +61,7 @@
FileAppender appender;
appender.setOption(LOG4CXX_STR("FILE"), LOG4CXX_STR("output\\\\temp"));
const File& file = appender.getFile();
- LOGUNIT_ASSERT_EQUAL((LogString) LOG4CXX_STR("output\\temp"), file.getPath());
+ LOGUNIT_ASSERT_EQUAL((LogString) LOG4CXX_STR("output\\temp"), getPath(file));
}
/**
@@ -75,7 +75,7 @@
FileAppender appender;
appender.setOption(LOG4CXX_STR("FILE"), LOG4CXX_STR("output\\\\temp"));
const File& file = appender.getFile();
- LOGUNIT_ASSERT_EQUAL((LogString) LOG4CXX_STR("output\\temp"), file.getPath());
+ LOGUNIT_ASSERT_EQUAL((LogString) LOG4CXX_STR("output\\temp"), getPath(file));
}
/**
diff --git a/src/test/cpp/filetestcase.cpp b/src/test/cpp/filetestcase.cpp
index 00146c8..783d977 100644
--- a/src/test/cpp/filetestcase.cpp
+++ b/src/test/cpp/filetestcase.cpp
@@ -73,7 +73,7 @@
void defaultConstructor()
{
File defFile;
- LOGUNIT_ASSERT_EQUAL((LogString) LOG4CXX_STR(""), defFile.getPath());
+ LOGUNIT_ASSERT_EQUAL((LogString) LOG4CXX_STR(""), getPath(defFile));
}
@@ -82,8 +82,8 @@
{
File defFile;
Pool pool;
- bool exists = defFile.exists(pool);
- LOGUNIT_ASSERT_EQUAL(false, exists);
+ bool found = exists(pool, defFile);
+ LOGUNIT_ASSERT_EQUAL(false, found);
}
// check default constructor. read() throws an exception
@@ -111,8 +111,8 @@
{
File propFile(L"input/patternLayout1.properties");
Pool pool;
- bool exists = propFile.exists(pool);
- LOGUNIT_ASSERT_EQUAL(true, exists);
+ bool found = exists(pool, propFile);
+ LOGUNIT_ASSERT_EQUAL(true, found);
}
#endif
@@ -125,8 +125,8 @@
};
File propFile(filename);
Pool pool;
- bool exists = propFile.exists(pool);
- LOGUNIT_ASSERT_EQUAL(true, exists);
+ bool found = exists(pool, propFile);
+ LOGUNIT_ASSERT_EQUAL(true, found);
}
#endif
@@ -135,8 +135,8 @@
{
File propFile(CFSTR("input/patternLayout1.properties"));
Pool pool;
- bool exists = propFile.exists(pool);
- LOGUNIT_ASSERT_EQUAL(true, exists);
+ bool found = exists(pool, propFile);
+ LOGUNIT_ASSERT_EQUAL(true, found);
}
#endif
@@ -145,8 +145,8 @@
File propFile("input/patternLayout1.properties");
File copy(propFile);
Pool pool;
- bool exists = copy.exists(pool);
- LOGUNIT_ASSERT_EQUAL(true, exists);
+ bool found = exists(pool, copy);
+ LOGUNIT_ASSERT_EQUAL(true, found);
}
void assignment()
@@ -154,8 +154,8 @@
File propFile("input/patternLayout1.properties");
File copy = propFile;
Pool pool;
- bool exists = copy.exists(pool);
- LOGUNIT_ASSERT_EQUAL(true, exists);
+ bool found = exists(pool, copy);
+ LOGUNIT_ASSERT_EQUAL(true, found);
}
void propertyRead()
@@ -173,8 +173,8 @@
{
File propFile("input/patternLayout1.properties");
Pool pool;
- bool exists = propFile.exists(pool);
- LOGUNIT_ASSERT_EQUAL(true, exists);
+ bool found = exists(pool, propFile);
+ LOGUNIT_ASSERT_EQUAL(true, found);
}
void fileWrite1()
@@ -204,7 +204,7 @@
{
File file("output\\bogus.txt");
Pool pool;
- /*bool deleted = */file.deleteFile(pool);
+ deleteFile(pool, file);
}
};
diff --git a/src/test/cpp/rolling/manualrollingtest.cpp b/src/test/cpp/rolling/manualrollingtest.cpp
index 9223ece..c451aed 100644
--- a/src/test/cpp/rolling/manualrollingtest.cpp
+++ b/src/test/cpp/rolling/manualrollingtest.cpp
@@ -131,9 +131,9 @@
common(rfa, p, logger);
- LOGUNIT_ASSERT_EQUAL(true, File("output/manual-test1.0").exists(p));
- LOGUNIT_ASSERT_EQUAL(true, File("output/manual-test1.1").exists(p));
- LOGUNIT_ASSERT_EQUAL(true, File("output/manual-test1.2").exists(p));
+ LOGUNIT_ASSERT_EQUAL(true, exists(p, File("output/manual-test1.0")));
+ LOGUNIT_ASSERT_EQUAL(true, exists(p, File("output/manual-test1.1")));
+ LOGUNIT_ASSERT_EQUAL(true, exists(p, File("output/manual-test1.2")));
LOGUNIT_ASSERT_EQUAL(true, Compare::compare(File("output/manual-test1.0"),
File("witness/rolling/sbr-test2.log")));
LOGUNIT_ASSERT_EQUAL(true, Compare::compare(File("output/manual-test1.1"),
@@ -160,9 +160,9 @@
common(rfa, p, logger);
- LOGUNIT_ASSERT_EQUAL(true, File("output/manual-test2.log").exists(p));
- LOGUNIT_ASSERT_EQUAL(true, File("output/manual-test2.log.1").exists(p));
- LOGUNIT_ASSERT_EQUAL(true, File("output/manual-test2.log.2").exists(p));
+ LOGUNIT_ASSERT_EQUAL(true, exists(p, File("output/manual-test2.log")));
+ LOGUNIT_ASSERT_EQUAL(true, exists(p, File("output/manual-test2.log.1")));
+ LOGUNIT_ASSERT_EQUAL(true, exists(p, File("output/manual-test2.log.2")));
LOGUNIT_ASSERT_EQUAL(true, Compare::compare(File("output/manual-test2.log"),
File("witness/rolling/sbr-test2.log")));
@@ -195,13 +195,13 @@
common(rfa, p, logger);
- LOGUNIT_ASSERT_EQUAL(true, File("output/manual-test3.log").exists(p));
- LOGUNIT_ASSERT_EQUAL(true, File("output/manual-test3.0.gz").exists(p));
- LOGUNIT_ASSERT_EQUAL(true, File("output/manual-test3.1.gz").exists(p));
+ LOGUNIT_ASSERT_EQUAL(true, exists(p, File("output/manual-test3.log")));
+ LOGUNIT_ASSERT_EQUAL(true, exists(p, File("output/manual-test3.0.gz")));
+ LOGUNIT_ASSERT_EQUAL(true, exists(p, File("output/manual-test3.1.gz")));
LOGUNIT_ASSERT_EQUAL(true, Compare::compare(File("output/manual-test3.log"), File("witness/rolling/sbr-test3.log")));
- LOGUNIT_ASSERT_EQUAL(File("witness/rolling/sbr-test3.0.gz").length(p), File("output/manual-test3.0.gz").length(p));
- LOGUNIT_ASSERT_EQUAL(File("witness/rolling/sbr-test3.1.gz").length(p), File("output/manual-test3.1.gz").length(p));
+ LOGUNIT_ASSERT_EQUAL(length(p, File("witness/rolling/sbr-test3.0.gz")), length(p, File("output/manual-test3.0.gz")));
+ LOGUNIT_ASSERT_EQUAL(length(p, File("witness/rolling/sbr-test3.1.gz")), length(p, File("output/manual-test3.1.gz")));
}
/**
@@ -233,7 +233,7 @@
common(rfa, p, logger);
- LOGUNIT_ASSERT_EQUAL(true, File("output/manual-test4.log").exists(p));
+ LOGUNIT_ASSERT_EQUAL(true, exists(p, File("output/manual-test4.log")));
LOGUNIT_ASSERT_EQUAL(true, Compare::compare(File("output/manual-test4.log"),
File("witness/rolling/sbr-test4.log")));
@@ -276,16 +276,16 @@
os0.close(p);
- if (File("output/manual-test5.3").exists(p))
+ if (exists(p, File("output/manual-test5.3")))
{
//
// looks like platform where open files can be renamed
//
- LOGUNIT_ASSERT_EQUAL(true, File("output/manual-test5.log").exists(p));
- LOGUNIT_ASSERT_EQUAL(true, File("output/manual-test5.0").exists(p));
- LOGUNIT_ASSERT_EQUAL(true, File("output/manual-test5.1").exists(p));
- LOGUNIT_ASSERT_EQUAL(true, File("output/manual-test5.2").exists(p));
- LOGUNIT_ASSERT_EQUAL(true, File("output/manual-test5.3").exists(p));
+ LOGUNIT_ASSERT_EQUAL(true, exists(p, File("output/manual-test5.log")));
+ LOGUNIT_ASSERT_EQUAL(true, exists(p, File("output/manual-test5.0")));
+ LOGUNIT_ASSERT_EQUAL(true, exists(p, File("output/manual-test5.1")));
+ LOGUNIT_ASSERT_EQUAL(true, exists(p, File("output/manual-test5.2")));
+ LOGUNIT_ASSERT_EQUAL(true, exists(p, File("output/manual-test5.3")));
LOGUNIT_ASSERT_EQUAL(true, Compare::compare(File("output/manual-test5.log"),
File("witness/rolling/sbr-test2.log")));
@@ -302,9 +302,9 @@
// so initial log file should have all log content
// open file should be unaffected
// stray file should have only been moved one slot.
- LOGUNIT_ASSERT_EQUAL(true, File("output/manual-test5.log").exists(p));
- LOGUNIT_ASSERT_EQUAL(true, File("output/manual-test5.0").exists(p));
- LOGUNIT_ASSERT_EQUAL(true, File("output/manual-test5.2").exists(p));
+ LOGUNIT_ASSERT_EQUAL(true, exists(p, File("output/manual-test5.log")));
+ LOGUNIT_ASSERT_EQUAL(true, exists(p, File("output/manual-test5.0")));
+ LOGUNIT_ASSERT_EQUAL(true, exists(p, File("output/manual-test5.2")));
LOGUNIT_ASSERT_EQUAL(true, Compare::compare(File("output/manual-test5.log"),
File("witness/rolling/sbr-test4.log")));
@@ -345,8 +345,8 @@
common(rfa, p, logger);
- LOGUNIT_ASSERT_EQUAL(true, File(filenamePatternPrefix + LOG4CXX_STR("/file-0.gz")).exists(p));
- LOGUNIT_ASSERT_EQUAL(true, File(filenamePatternPrefix + LOG4CXX_STR("/file-1.gz")).exists(p));
+ LOGUNIT_ASSERT_EQUAL(true, exists(p, File(filenamePatternPrefix + LOG4CXX_STR("/file-0.gz"))));
+ LOGUNIT_ASSERT_EQUAL(true, exists(p, File(filenamePatternPrefix + LOG4CXX_STR("/file-1.gz"))));
}
};
diff --git a/src/test/cpp/rolling/rollingfileappenderpropertiestest.cpp b/src/test/cpp/rolling/rollingfileappenderpropertiestest.cpp
index 7ab1020..c522fa2 100644
--- a/src/test/cpp/rolling/rollingfileappenderpropertiestest.cpp
+++ b/src/test/cpp/rolling/rollingfileappenderpropertiestest.cpp
@@ -103,8 +103,8 @@
}
Pool p;
- LOGUNIT_ASSERT_EQUAL(true, File("output/obsoleteRFA-test1.log").exists(p));
- LOGUNIT_ASSERT_EQUAL(true, File("output/obsoleteRFA-test1.log.1").exists(p));
+ LOGUNIT_ASSERT_EQUAL(true, exists(p, File("output/obsoleteRFA-test1.log")));
+ LOGUNIT_ASSERT_EQUAL(true, exists(p, File("output/obsoleteRFA-test1.log.1")));
}
/**
@@ -145,8 +145,8 @@
}
}
- LOGUNIT_ASSERT_EQUAL(true, File("output/obsoleteRFA-test2.log").exists(p));
- LOGUNIT_ASSERT_EQUAL(true, File("output/obsoleteRFA-test2.log.1").exists(p));
+ LOGUNIT_ASSERT_EQUAL(true, exists(p, File("output/obsoleteRFA-test2.log")));
+ LOGUNIT_ASSERT_EQUAL(true, exists(p, File("output/obsoleteRFA-test2.log.1")));
}
/**
@@ -244,7 +244,7 @@
static int getFileCount(const char* dir, const LogString & initial)
{
Pool p;
- std::vector<LogString> files(File(dir).list(p));
+ std::vector<LogString> files = getFileList(p, File(dir));
int count = 0;
for (size_t i = 0; i < files.size(); i++)
diff --git a/src/test/cpp/rolling/sizebasedrollingtest.cpp b/src/test/cpp/rolling/sizebasedrollingtest.cpp
index ddb0f2d..414987b 100644
--- a/src/test/cpp/rolling/sizebasedrollingtest.cpp
+++ b/src/test/cpp/rolling/sizebasedrollingtest.cpp
@@ -130,9 +130,9 @@
common(logger, 0);
- LOGUNIT_ASSERT_EQUAL(true, File("output/sizeBased-test1.0").exists(p));
- LOGUNIT_ASSERT_EQUAL(true, File("output/sizeBased-test1.1").exists(p));
- LOGUNIT_ASSERT_EQUAL(true, File("output/sizeBased-test1.2").exists(p));
+ LOGUNIT_ASSERT_EQUAL(true, exists(p, File("output/sizeBased-test1.0")));
+ LOGUNIT_ASSERT_EQUAL(true, exists(p, File("output/sizeBased-test1.1")));
+ LOGUNIT_ASSERT_EQUAL(true, exists(p, File("output/sizeBased-test1.2")));
LOGUNIT_ASSERT_EQUAL(true, Compare::compare(File("output/sizeBased-test1.0"),
File("witness/rolling/sbr-test2.log")));
LOGUNIT_ASSERT_EQUAL(true, Compare::compare(File("output/sizeBased-test1.1"),
@@ -170,9 +170,9 @@
common(logger, 0);
- LOGUNIT_ASSERT_EQUAL(true, File("output/sizeBased-test2.log").exists(p));
- LOGUNIT_ASSERT_EQUAL(true, File("output/sizeBased-test2.0").exists(p));
- LOGUNIT_ASSERT_EQUAL(true, File("output/sizeBased-test2.1").exists(p));
+ LOGUNIT_ASSERT_EQUAL(true, exists(p, File("output/sizeBased-test2.log")));
+ LOGUNIT_ASSERT_EQUAL(true, exists(p, File("output/sizeBased-test2.0")));
+ LOGUNIT_ASSERT_EQUAL(true, exists(p, File("output/sizeBased-test2.1")));
LOGUNIT_ASSERT_EQUAL(true, Compare::compare(File("output/sizeBased-test2.log"),
File("witness/rolling/sbr-test2.log")));
@@ -208,13 +208,13 @@
common(logger, 100);
- LOGUNIT_ASSERT_EQUAL(true, File("output/sbr-test3.log").exists(p));
- LOGUNIT_ASSERT_EQUAL(true, File("output/sbr-test3.0.gz").exists(p));
- LOGUNIT_ASSERT_EQUAL(true, File("output/sbr-test3.1.gz").exists(p));
+ LOGUNIT_ASSERT_EQUAL(true, exists(p, File("output/sbr-test3.log")));
+ LOGUNIT_ASSERT_EQUAL(true, exists(p, File("output/sbr-test3.0.gz")));
+ LOGUNIT_ASSERT_EQUAL(true, exists(p, File("output/sbr-test3.1.gz")));
LOGUNIT_ASSERT_EQUAL(true, Compare::compare(File("output/sbr-test3.log"), File("witness/rolling/sbr-test3.log")));
- LOGUNIT_ASSERT_EQUAL(File("witness/rolling/sbr-test3.0.gz").length(p), File("output/sbr-test3.0.gz").length(p));
- LOGUNIT_ASSERT_EQUAL(File("witness/rolling/sbr-test3.1.gz").length(p), File("output/sbr-test3.1.gz").length(p));
+ LOGUNIT_ASSERT_EQUAL(length(p, File("witness/rolling/sbr-test3.0.gz")), length(p, File("output/sbr-test3.0.gz")));
+ LOGUNIT_ASSERT_EQUAL(length(p, File("witness/rolling/sbr-test3.1.gz")), length(p, File("output/sbr-test3.1.gz")));
}
/**
@@ -249,7 +249,7 @@
common(logger, 0);
- LOGUNIT_ASSERT_EQUAL(true, File("output/sizeBased-test4.log").exists(p));
+ LOGUNIT_ASSERT_EQUAL(true, exists(p, File("output/sizeBased-test4.log")));
LOGUNIT_ASSERT_EQUAL(true, Compare::compare(File("output/sizeBased-test4.log"),
File("witness/rolling/sbr-test4.log")));
@@ -295,16 +295,16 @@
os0.close(p);
- if (File("output/sizeBased-test5.3").exists(p))
+ if (exists(p, File("output/sizeBased-test5.3")))
{
//
// looks like platform where open files can be renamed
//
- LOGUNIT_ASSERT_EQUAL(true, File("output/sizeBased-test5.log").exists(p));
- LOGUNIT_ASSERT_EQUAL(true, File("output/sizeBased-test5.0").exists(p));
- LOGUNIT_ASSERT_EQUAL(true, File("output/sizeBased-test5.1").exists(p));
- LOGUNIT_ASSERT_EQUAL(true, File("output/sizeBased-test5.2").exists(p));
- LOGUNIT_ASSERT_EQUAL(true, File("output/sizeBased-test5.3").exists(p));
+ LOGUNIT_ASSERT_EQUAL(true, exists(p, File("output/sizeBased-test5.log")));
+ LOGUNIT_ASSERT_EQUAL(true, exists(p, File("output/sizeBased-test5.0")));
+ LOGUNIT_ASSERT_EQUAL(true, exists(p, File("output/sizeBased-test5.1")));
+ LOGUNIT_ASSERT_EQUAL(true, exists(p, File("output/sizeBased-test5.2")));
+ LOGUNIT_ASSERT_EQUAL(true, exists(p, File("output/sizeBased-test5.3")));
LOGUNIT_ASSERT_EQUAL(true, Compare::compare(File("output/sizeBased-test5.log"),
File("witness/rolling/sbr-test2.log")));
@@ -321,9 +321,9 @@
// so initial log file should have all log content
// open file should be unaffected
// stray file should have only been moved one slot.
- LOGUNIT_ASSERT_EQUAL(true, File("output/sizeBased-test5.log").exists(p));
- LOGUNIT_ASSERT_EQUAL(true, File("output/sizeBased-test5.0").exists(p));
- LOGUNIT_ASSERT_EQUAL(true, File("output/sizeBased-test5.2").exists(p));
+ LOGUNIT_ASSERT_EQUAL(true, exists(p, File("output/sizeBased-test5.log")));
+ LOGUNIT_ASSERT_EQUAL(true, exists(p, File("output/sizeBased-test5.0")));
+ LOGUNIT_ASSERT_EQUAL(true, exists(p, File("output/sizeBased-test5.2")));
LOGUNIT_ASSERT_EQUAL(true, Compare::compare(File("output/sizeBased-test5.log"),
File("witness/rolling/sbr-test4.log")));
@@ -356,9 +356,9 @@
common(logger, 100);
- LOGUNIT_ASSERT_EQUAL(true, File("output/sbr-test6.log").exists(p));
- LOGUNIT_ASSERT_EQUAL(true, File("output/sbr-test6.0.zip").exists(p));
- LOGUNIT_ASSERT_EQUAL(true, File("output/sbr-test6.1.zip").exists(p));
+ LOGUNIT_ASSERT_EQUAL(true, exists(p, File("output/sbr-test6.log")));
+ LOGUNIT_ASSERT_EQUAL(true, exists(p, File("output/sbr-test6.0.zip")));
+ LOGUNIT_ASSERT_EQUAL(true, exists(p, File("output/sbr-test6.1.zip")));
LOGUNIT_ASSERT_EQUAL(true, Compare::compare(File("output/sbr-test6.log"), File("witness/rolling/sbr-test3.log")));
}
diff --git a/src/test/cpp/rolling/timebasedrollingtest.cpp b/src/test/cpp/rolling/timebasedrollingtest.cpp
index 5b1e082..daca44c 100644
--- a/src/test/cpp/rolling/timebasedrollingtest.cpp
+++ b/src/test/cpp/rolling/timebasedrollingtest.cpp
@@ -293,7 +293,7 @@
for (int i = 0; i < N - 1; ++i)
{
//std::wcerr << L"Check: " << fnames[i] << L"\n";
- LOGUNIT_ASSERT_EQUAL_SRCL(true, File(fnames[i]).exists(pool), srcLine);
+ LOGUNIT_ASSERT_EQUAL_SRCL(true, exists(pool, File(fnames[i])), srcLine);
}
this->compareWitness(pool, prefix, fnames[witnessIdx], witnessIdx, srcLine);
@@ -343,7 +343,7 @@
Pool& pool,
LogString path)
{
- File(path).deleteFile(pool);
+ deleteFile(pool, File(path));
}
/**
diff --git a/src/test/cpp/util/compare.cpp b/src/test/cpp/util/compare.cpp
index d71f547..c0d54dd 100644
--- a/src/test/cpp/util/compare.cpp
+++ b/src/test/cpp/util/compare.cpp
@@ -57,9 +57,9 @@
if (s1 != s2)
{
LogString msg(LOG4CXX_STR("Files ["));
- msg += file1.getPath();
+ msg += getPath(file1);
msg += LOG4CXX_STR("] and [");
- msg += file2.getPath();
+ msg += getPath(file2);
msg += LOG4CXX_STR("] differ on line ");
StringHelper::toString(lineCounter, pool, msg);
msg += LOG4CXX_EOL;
@@ -84,9 +84,9 @@
if (getline(in2, s2))
{
LogString msg(LOG4CXX_STR("File ["));
- msg += file2.getPath();
+ msg += getPath(file2);
msg += LOG4CXX_STR("] longer than file [");
- msg += file1.getPath();
+ msg += getPath(file1);
msg += LOG4CXX_STR("].");
msg += LOG4CXX_EOL;
emit(msg);
@@ -107,7 +107,7 @@
emit(LOG4CXX_STR("--------------------------------"));
emit(LOG4CXX_EOL);
LogString msg(LOG4CXX_STR("Contents of "));
- msg += file.getPath();
+ msg += getPath(file);
msg += LOG4CXX_STR(":");
msg += LOG4CXX_EOL;
emit(msg);
diff --git a/src/test/cpp/util/compare.h b/src/test/cpp/util/compare.h
index be807c6..59f791a 100644
--- a/src/test/cpp/util/compare.h
+++ b/src/test/cpp/util/compare.h
@@ -15,15 +15,10 @@
* limitations under the License.
*/
-#include <log4cxx/logstring.h>
+#include <log4cxx/file.h>
namespace LOG4CXX_NS
{
-class File;
-namespace helpers
-{
-class Pool;
-}
class Compare
{
diff --git a/src/test/cpp/util/transformer.cpp b/src/test/cpp/util/transformer.cpp
index 96ed877..ca70815 100644
--- a/src/test/cpp/util/transformer.cpp
+++ b/src/test/cpp/util/transformer.cpp
@@ -18,6 +18,7 @@
#include "transformer.h"
#include <log4cxx/file.h>
#include <log4cxx/helpers/transcoder.h>
+#include <log4cxx/helpers/pool.h>
#include <apr_thread_proc.h>
#include <apr_pools.h>
#include <apr_file_io.h>
@@ -68,7 +69,7 @@
void Transformer::copyFile(const File& in, const File& out)
{
- Pool p;
+ helpers::Pool p;
apr_pool_t* pool = p.getAPRPool();
@@ -78,11 +79,11 @@
//
apr_file_t* child_out;
apr_int32_t flags = APR_FOPEN_WRITE | APR_FOPEN_CREATE | APR_FOPEN_TRUNCATE;
- apr_status_t stat = out.open(&child_out, flags, APR_OS_DEFAULT, p);
+ apr_status_t stat = openFile(out, &child_out, flags, APR_OS_DEFAULT, p);
assert(stat == APR_SUCCESS);
apr_file_t* in_file;
- stat = in.open(&in_file, APR_FOPEN_READ, APR_OS_DEFAULT, p);
+ stat = openFile(in, &in_file, APR_FOPEN_READ, APR_OS_DEFAULT, p);
assert(stat == APR_SUCCESS);
apr_size_t bufsize = 32000;
void* buf = apr_palloc(pool, bufsize);
@@ -158,7 +159,7 @@
}
else
{
- Pool p;
+ helpers::Pool p;
apr_pool_t* pool = p.getAPRPool();
//
@@ -166,7 +167,7 @@
// may get mangled if passed as parameters
//
std::string regexName;
- Transcoder::encode(in.getPath(), regexName);
+ Transcoder::encode(getPath(in), regexName);
regexName.append(".sed");
createSedCommandFile(regexName, patterns, pool);
@@ -210,7 +211,7 @@
//
// specify the input file
- args[i++] = Transcoder::encode(in.getPath(), p);
+ args[i++] = Transcoder::encode(getPath(in), p);
args[i] = NULL;
@@ -221,7 +222,7 @@
apr_file_t* child_out;
apr_int32_t flags = APR_FOPEN_READ | APR_FOPEN_WRITE |
APR_FOPEN_CREATE | APR_FOPEN_TRUNCATE;
- stat = out.open(&child_out, flags, APR_OS_DEFAULT, p);
+ stat = openFile(out, &child_out, flags, APR_OS_DEFAULT, p);
assert(stat == APR_SUCCESS);
stat = apr_procattr_child_out_set(attr, child_out, NULL);
diff --git a/src/test/cpp/util/transformer.h b/src/test/cpp/util/transformer.h
index e7ac49e..8842cfd 100644
--- a/src/test/cpp/util/transformer.h
+++ b/src/test/cpp/util/transformer.h
@@ -20,6 +20,7 @@
#include "filter.h"
#include <vector>
+#include <log4cxx/file.h>
extern "C" {
struct apr_pool_t;
@@ -27,7 +28,6 @@
namespace LOG4CXX_NS
{
-class File;
class Transformer
{
diff --git a/src/test/cpp/xml/domtestcase.cpp b/src/test/cpp/xml/domtestcase.cpp
index e254868..ea801d3 100644
--- a/src/test/cpp/xml/domtestcase.cpp
+++ b/src/test/cpp/xml/domtestcase.cpp
@@ -200,11 +200,10 @@
#else
const logchar fname[] = { 0x6F, 0x75, 0x74, 0x70, 0x75, 0x74, 0x2F, 0x64, 0x6F, 0x6D, static_cast<logchar>(0xB3), 0 };
#endif
- File file;
- file.setPath(fname);
+ File file(fname);
Pool p;
- bool exists = file.exists(p);
- LOGUNIT_ASSERT(exists);
+ bool found = exists(p, file);
+ LOGUNIT_ASSERT(found);
}
/**
@@ -220,11 +219,10 @@
#else
const logchar fname[] = { 0x6F, 0x75, 0x74, 0x70, 0x75, 0x74, 0x2F, 0x64, 0x6F, 0x6D, static_cast<logchar>(0x3195), 0 };
#endif
- File file;
- file.setPath(fname);
+ File file(fname);
Pool p;
- bool exists = file.exists(p);
- LOGUNIT_ASSERT(exists);
+ bool found = exists(p, file);
+ LOGUNIT_ASSERT(found);
}
};