diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2019-02-07 19:06:43 +0000 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2019-02-07 19:06:43 +0000 |
commit | 115f6dd6e6bd7be6173effec94a4b48289328d70 (patch) | |
tree | 6f21e91216f6db2f5875635b66737b69761f4a48 | |
parent | GCC-8.2 and libadhocutil-0.6 compat fixes (diff) | |
download | project2-115f6dd6e6bd7be6173effec94a4b48289328d70.tar.bz2 project2-115f6dd6e6bd7be6173effec94a4b48289328d70.tar.xz project2-115f6dd6e6bd7be6173effec94a4b48289328d70.zip |
Remove boost::filesystem in favour of std::filesystem
60 files changed, 303 insertions, 309 deletions
diff --git a/project2/basics/Jamfile.jam b/project2/basics/Jamfile.jam index e1be712..3a53d54 100644 --- a/project2/basics/Jamfile.jam +++ b/project2/basics/Jamfile.jam @@ -2,7 +2,7 @@ alias glibmm : : : : <cflags>"`pkg-config --cflags glibmm-2.4`" <linkflags>"`pkg-config --libs glibmm-2.4`" ; -lib boost_filesystem : : <name>boost_filesystem ; +lib stdc++fs ; lib dl ; build-project unittests ; @@ -19,7 +19,7 @@ lib p2basics : <include>. <library>glibmm <library>dl - <library>boost_filesystem + <library>stdc++fs <library>../common//p2common : : <include>. diff --git a/project2/basics/options/preload.cpp b/project2/basics/options/preload.cpp index 506be1d..1968023 100644 --- a/project2/basics/options/preload.cpp +++ b/project2/basics/options/preload.cpp @@ -2,12 +2,12 @@ #include <options.h> #include <library.h> #include <appInstance.h> -#include <boost/filesystem/path.hpp> +#include <filesystem> #include <map> #include <dlfcn.h> #include <logger.h> -using namespace boost::filesystem; +using namespace std::filesystem; class Preload { public: diff --git a/project2/basics/unittests/Jamfile.jam b/project2/basics/unittests/Jamfile.jam index c5b14c6..5892cd9 100644 --- a/project2/basics/unittests/Jamfile.jam +++ b/project2/basics/unittests/Jamfile.jam @@ -14,7 +14,7 @@ run <library>../../common//p2common <library>..//p2basics <library>../../ut//p2ut - <library>..//boost_filesystem + <library>..//stdc++fs : testLibraries : ; @@ -28,7 +28,7 @@ run <library>../../ut//p2ut <library>../../xml//p2xml <library>../../url//p2url - <library>..//boost_filesystem + <library>..//stdc++fs : standardTests : ; diff --git a/project2/basics/unittests/testLibraries.cpp b/project2/basics/unittests/testLibraries.cpp index a1aef90..c43d382 100644 --- a/project2/basics/unittests/testLibraries.cpp +++ b/project2/basics/unittests/testLibraries.cpp @@ -1,6 +1,6 @@ #define BOOST_TEST_MODULE Client #include <boost/test/unit_test.hpp> -#include <boost/filesystem/convenience.hpp> +#include <filesystem> #include <testOptionsSource.h> #include <exceptions.h> #include <library.h> @@ -9,8 +9,8 @@ #define XSTR(s) STR(s) #define STR(s) #s -const boost::filesystem::path root(XSTR(ROOT)); -const auto self = boost::filesystem::canonical("/proc/self/exe"); +const std::filesystem::path root(XSTR(ROOT)); +const auto self = std::filesystem::canonical("/proc/self/exe"); BOOST_FIXTURE_TEST_SUITE( Core, TestAppInstance ); @@ -28,7 +28,7 @@ BOOST_AUTO_TEST_CASE( load_and_unload_library ) // Path to test lib needs passing in BOOST_REQUIRE_EQUAL(2, args.size()); auto libraryPath = args[1]; - BOOST_REQUIRE(boost::filesystem::exists(libraryPath)); + BOOST_REQUIRE(std::filesystem::exists(libraryPath)); BOOST_REQUIRE_THROW(TaskFactory::get("DummyTask"), AdHoc::NoSuchPluginException); diff --git a/project2/basics/unittests/testViews.cpp b/project2/basics/unittests/testViews.cpp index 2303f1c..1dbb30e 100644 --- a/project2/basics/unittests/testViews.cpp +++ b/project2/basics/unittests/testViews.cpp @@ -1,6 +1,6 @@ #define BOOST_TEST_MODULE Views #include <boost/test/unit_test.hpp> -#include <boost/filesystem/operations.hpp> +#include <filesystem> #include <xmlScriptParser.h> #include <testOptionsSource.h> #include <testScriptHost.h> @@ -8,11 +8,11 @@ #include <testAppInstance.h> std::shared_ptr<TestScriptHost> -executeRowViewTest(ExecContext * ec, const boost::filesystem::path & script, const boost::filesystem::path & expected) +executeRowViewTest(ExecContext * ec, const std::filesystem::path & script, const std::filesystem::path & expected) { TestOptionsSource::LoadTestOptions({ { "common.datasourceRoot", rootDir.string() }, - { "application.dataroot", ("file://" / rootDir / "data").string() }, + { "application.dataroot", "file://" + (rootDir / "data").string() }, }); BOOST_TEST_CHECKPOINT("Load"); ScriptReaderPtr r = std::make_shared<XmlScriptParser>(script); diff --git a/project2/cgi/Jamfile.jam b/project2/cgi/Jamfile.jam index 2de7856..9f47a72 100644 --- a/project2/cgi/Jamfile.jam +++ b/project2/cgi/Jamfile.jam @@ -2,7 +2,7 @@ alias glibmm : : : : <cflags>"`pkg-config --cflags glibmm-2.4`" <linkflags>"`pkg-config --libs glibmm-2.4`" ; -lib boost_filesystem : : <name>boost_filesystem ; +lib stdc++fs ; lib cgicc : : <name>cgicc ; lib fcgi : : <name>fcgi ; lib fcgi++ : : <name>fcgi++ ; @@ -12,7 +12,7 @@ cpp-pch pch : pch.hpp : <library>cgicc <library>glibmm <library>../common//p2common - <library>boost_filesystem + <library>stdc++fs <library>../xml//p2xml ; lib p2cgicommon : @@ -24,7 +24,7 @@ lib p2cgicommon : <library>glibmm <library>../common//p2common <library>..//adhocutil - <library>boost_filesystem + <library>stdc++fs <library>../xml//p2xml <library>gcrypt : : @@ -45,7 +45,7 @@ exe p2fcgi : fcgi : <library>p2cgicommon - <library>boost_filesystem + <library>stdc++fs ; exe testCgi : diff --git a/project2/cgi/cgiProgRouter.cpp b/project2/cgi/cgiProgRouter.cpp index 983e8cd..3070c91 100644 --- a/project2/cgi/cgiProgRouter.cpp +++ b/project2/cgi/cgiProgRouter.cpp @@ -1,5 +1,5 @@ #include <pch.hpp> -#include <boost/filesystem/path.hpp> +#include <filesystem> #include <boost/algorithm/string/predicate.hpp> #include "cgiRequestContext.h" #include "commonObjects.h" @@ -91,8 +91,8 @@ class RoutingTable { present(s->value("present", NULL).as<std::string>()), path(s->value("path", NULL).as<std::string>()) { - boost::filesystem::path fspath = path; - boost::filesystem::path::iterator p = fspath.begin(); + std::filesystem::path fspath = path; + std::filesystem::path::iterator p = fspath.begin(); p++; while(p != fspath.end() && p->string() != ".") { switch (p->string().front()) { @@ -106,8 +106,8 @@ class RoutingTable { p++; } } - bool matches(const boost::filesystem::path & path, VarMap & vars) const { - boost::filesystem::path::iterator p = path.begin(); + bool matches(const std::filesystem::path & path, VarMap & vars) const { + std::filesystem::path::iterator p = path.begin(); p++; for (RouteElems::const_iterator re = routeElems.begin(); re != routeElems.end() || p != path.end(); re++) { if (re == routeElems.end() || p == path.end() || !(*re)->matches(p->string(), vars)) { @@ -172,8 +172,8 @@ class ProgRouter : public Router { } void present(const MultiRowSetPresenter * p) const { p->addNewArray("uriElem", true); - boost::filesystem::path y(path); - boost::filesystem::path::iterator pathPart = y.begin(); + std::filesystem::path y(path); + std::filesystem::path::iterator pathPart = y.begin(); while(++pathPart != y.end()) { p->addNamedValue("uriElem", pathPart->string()); } diff --git a/project2/cgi/cgiSimpleRouter.cpp b/project2/cgi/cgiSimpleRouter.cpp index bc8c544..0eaea0f 100644 --- a/project2/cgi/cgiSimpleRouter.cpp +++ b/project2/cgi/cgiSimpleRouter.cpp @@ -1,15 +1,15 @@ #include "cgiRequestContext.h" -#include <boost/filesystem/path.hpp> +#include <filesystem> #include "scriptLoader.h" #include "presenter.h" SimpleNumericException(UriElementOutOfRange); std::vector<std::string> -makeVector(const boost::filesystem::path & y) +makeVector(const std::filesystem::path & y) { std::vector<std::string> r; - boost::filesystem::path::iterator p = y.begin(); + std::filesystem::path::iterator p = y.begin(); p++; while(p != y.end()) { r.push_back((p++)->string()); @@ -41,8 +41,8 @@ class SimpleRouter : public Router { } void present(const MultiRowSetPresenter * p) const { p->addNewArray("uriElem", true); - boost::filesystem::path y(path); - boost::filesystem::path::iterator pathPart = y.begin(); + std::filesystem::path y(path); + std::filesystem::path::iterator pathPart = y.begin(); while(++pathPart != y.end()) { p->addNamedValue("uriElem", pathPart->string()); } diff --git a/project2/cgi/p2webFCgi.cpp b/project2/cgi/p2webFCgi.cpp index fae6cca..1a63346 100644 --- a/project2/cgi/p2webFCgi.cpp +++ b/project2/cgi/p2webFCgi.cpp @@ -1,7 +1,7 @@ #include "FCgiIO.h" #include "cgiAppEngine.h" #include <boost/bind.hpp> -#include <boost/filesystem/convenience.hpp> +#include <filesystem> time_t lastPeriodic = 0; time_t periodicDelay = 600; @@ -40,12 +40,13 @@ main(void) fprintf(stderr, "Failed to set signal handler\n"); } alarm(60); + auto initial_path(std::filesystem::current_path()); LifeCycle::onAllComponents(boost::bind(&LifeCycle::onBegin, _1)); CgiApplicationEngine app; while (FCGX_Accept_r(&request) == 0) { alarm(0); cgicc::FCgiIO IO(request); - boost::filesystem::current_path(boost::filesystem::initial_path()); + std::filesystem::current_path(initial_path); app.process(IO, &IO, IO); FCGX_Finish_r(&request); LifeCycle::onAllComponents(boost::bind(&LifeCycle::onIteration, _1)); diff --git a/project2/common/Jamfile.jam b/project2/common/Jamfile.jam index 5b6ad69..c9c683e 100644 --- a/project2/common/Jamfile.jam +++ b/project2/common/Jamfile.jam @@ -3,8 +3,7 @@ alias glibmm : : : : <linkflags>"`pkg-config --libs glibmm-2.4`" ; lib dl : : <name>dl ; -lib boost_system : : <name>boost_system ; -lib boost_filesystem : : <name>boost_filesystem ; +lib stdc++fs ; lib boost_date_time : : <name>boost_date_time ; build-project unittests ; @@ -21,13 +20,11 @@ lib p2common : <include>. <library>glibmm <library>dl - <library>boost_system - <library>boost_filesystem + <library>stdc++fs <library>boost_date_time <library>..//adhocutil : : <include>. - <library>boost_system <library>..//adhocutil ; diff --git a/project2/common/scripts.cpp b/project2/common/scripts.cpp index 0f8bce1..983a156 100644 --- a/project2/common/scripts.cpp +++ b/project2/common/scripts.cpp @@ -1,8 +1,7 @@ #include "scripts.h" #include <algorithm> #include "variables/fixed.h" -#include <boost/filesystem/convenience.hpp> -#include <boost/filesystem/path.hpp> +#include <filesystem> #include "appInstance.h" #include <plugins.impl.h> @@ -69,7 +68,7 @@ ScriptReader::load(const CommonObjects * co, bool childrenOnly) const ScriptReaderPtr ScriptReader::resolveScript(const std::string & group, const std::string & name, bool ii) { - boost::filesystem::path e(name); + std::filesystem::path e(name); while (!e.empty()) { ScriptKey sk(group, e.string()); ScriptReaderPtr rs = AppInstance::current().cachedScript(sk); diff --git a/project2/daemon/Jamfile.jam b/project2/daemon/Jamfile.jam index f304032..3dd1259 100644 --- a/project2/daemon/Jamfile.jam +++ b/project2/daemon/Jamfile.jam @@ -2,7 +2,7 @@ alias glibmm : : : : <cflags>"`pkg-config --cflags glibmm-2.4`" <linkflags>"`pkg-config --libs glibmm-2.4`" ; -lib boost_filesystem : : <name>boost_filesystem ; +lib stdc++fs ; lib pthread ; exe p2daemon : [ glob *.cpp ] @@ -12,7 +12,7 @@ exe p2daemon : <library>..//p2daemonparts <library>../common//p2common <library>../cli//p2cli - <library>boost_filesystem + <library>stdc++fs <library>pthread ; diff --git a/project2/daemon/p2daemonAppEngine.cpp b/project2/daemon/p2daemonAppEngine.cpp index 98f6b90..17db02b 100644 --- a/project2/daemon/p2daemonAppEngine.cpp +++ b/project2/daemon/p2daemonAppEngine.cpp @@ -16,7 +16,7 @@ int DaemonAppEngine::periodicTimeout; DaemonAppEngine::SignalMap DaemonAppEngine::signalMap; boost::optional<uid_t> DaemonAppEngine::setUser; boost::optional<gid_t> DaemonAppEngine::setGroup; -boost::optional<boost::filesystem::path> DaemonAppEngine::pidPath; +boost::optional<std::filesystem::path> DaemonAppEngine::pidPath; bool DaemonAppEngine::daemonize; SimpleMessageException(NoSuchUser); diff --git a/project2/daemon/p2daemonAppEngine.h b/project2/daemon/p2daemonAppEngine.h index cecdbbb..807f13c 100644 --- a/project2/daemon/p2daemonAppEngine.h +++ b/project2/daemon/p2daemonAppEngine.h @@ -3,7 +3,7 @@ #include <options.h> #include <boost/optional.hpp> -#include <boost/filesystem/path.hpp> +#include <filesystem> #include "lib/daemon.h" #include <thread> #include <glibmm/main.h> @@ -23,7 +23,7 @@ class DLL_PUBLIC DaemonAppEngine : AppInstance { static int periodicTimeout; static boost::optional<uid_t> setUser; static boost::optional<gid_t> setGroup; - static boost::optional<boost::filesystem::path> pidPath; + static boost::optional<std::filesystem::path> pidPath; static bool daemonize; protected: @@ -32,7 +32,7 @@ class DLL_PUBLIC DaemonAppEngine : AppInstance { static void IgnoreSignal(int signum); static void DefaultSignalHandler(int signum); - static void AddSignalHandler(int signum, const SignalFunc & handler); + static void AddSignalHandler(int signum, const SignalFunc & handler); static SignalMap signalMap; static void signalHandler(int); diff --git a/project2/daemon/pidfile.cpp b/project2/daemon/pidfile.cpp index e2487c7..f42d7be 100644 --- a/project2/daemon/pidfile.cpp +++ b/project2/daemon/pidfile.cpp @@ -2,34 +2,34 @@ #include "p2daemonAppEngine.h" #include <unistd.h> #include <boost/lexical_cast.hpp> -#include <boost/filesystem/operations.hpp> -#include <boost/filesystem/fstream.hpp> +#include <filesystem> +#include <fstream> SimpleMessageException(ChownFailed); -PidFile::PidFile(const boost::filesystem::path & path) : +PidFile::PidFile(const std::filesystem::path & path) : Path(path) { auto pidDir = Path.parent_path(); - if (!boost::filesystem::exists(pidDir)) { - boost::filesystem::create_directories(pidDir); + if (!std::filesystem::exists(pidDir)) { + std::filesystem::create_directories(pidDir); if (DaemonAppEngine::setGroup || DaemonAppEngine::setUser) { if (chown(pidDir.string().c_str(), DaemonAppEngine::setUser ? *DaemonAppEngine::setUser : -1, DaemonAppEngine::setGroup ? *DaemonAppEngine::setGroup : -1)) { - boost::filesystem::remove(pidDir); + std::filesystem::remove(pidDir); throw ChownFailed(strerror(errno)); } } } - boost::filesystem::ofstream pf(Path); + std::ofstream pf(Path); pf << getpid(); if (DaemonAppEngine::setGroup || DaemonAppEngine::setUser) { if (chown(Path.string().c_str(), DaemonAppEngine::setUser ? *DaemonAppEngine::setUser : -1, DaemonAppEngine::setGroup ? *DaemonAppEngine::setGroup : -1)) { - boost::filesystem::remove(Path); + std::filesystem::remove(Path); throw ChownFailed(strerror(errno)); } } @@ -37,6 +37,6 @@ PidFile::PidFile(const boost::filesystem::path & path) : PidFile::~PidFile() { - boost::filesystem::remove(Path); + std::filesystem::remove(Path); } diff --git a/project2/daemon/pidfile.h b/project2/daemon/pidfile.h index 108b0e7..4f57e8a 100644 --- a/project2/daemon/pidfile.h +++ b/project2/daemon/pidfile.h @@ -1,15 +1,15 @@ #ifndef PIDFILE_H #define PIDFILE_H -#include <boost/filesystem/path.hpp> +#include <filesystem> class PidFile { public: - PidFile(const boost::filesystem::path & path); + PidFile(const std::filesystem::path & path); ~PidFile(); private: - const boost::filesystem::path Path; + const std::filesystem::path Path; }; #endif diff --git a/project2/files/Jamfile.jam b/project2/files/Jamfile.jam index bf3b75c..7816ce8 100644 --- a/project2/files/Jamfile.jam +++ b/project2/files/Jamfile.jam @@ -4,8 +4,7 @@ alias glibmm : : : : <cflags>"`pkg-config --cflags glibmm-2.4`" <linkflags>"`pkg-config --libs glibmm-2.4`" ; -lib boost_system : : <name>boost_system ; -lib boost_filesystem : : <name>boost_filesystem ; +lib stdc++fs ; lib boost_iostreams : : <name>boost_iostreams ; lib gcrypt : : <name>gcrypt ; @@ -18,8 +17,7 @@ lib p2files : : <include>. <library>glibmm - <library>boost_filesystem - <library>boost_system + <library>stdc++fs <library>boost_iostreams <library>gcrypt <library>../common//p2common diff --git a/project2/files/fsFilterName.cpp b/project2/files/fsFilterName.cpp index 62ca04b..d1005a8 100644 --- a/project2/files/fsFilterName.cpp +++ b/project2/files/fsFilterName.cpp @@ -17,7 +17,7 @@ class FsRowSpecName : public FsRows::SpecBase { // from http://www.codeproject.com/KB/string/wildcmp.aspx Glib::ustring patt = pattern(ec); Glib::ustring::const_iterator wild = patt.begin(); - Glib::ustring leaf(curPath(fs).leaf().string()); + Glib::ustring leaf(curPath(fs).filename()); Glib::ustring::const_iterator string = leaf.begin(); while ((string != leaf.end()) && (*wild != '*')) { diff --git a/project2/files/fsRows.cpp b/project2/files/fsRows.cpp index 6d09178..127f1b1 100644 --- a/project2/files/fsRows.cpp +++ b/project2/files/fsRows.cpp @@ -4,7 +4,7 @@ #include "scriptLoader.h" #include "rowProcessor.h" #include "exceptions.h" -#include <boost/filesystem/operations.hpp> +#include <filesystem> #include <boost/algorithm/string/predicate.hpp> #include <boost/algorithm/string/split.hpp> #include <boost/bind.hpp> @@ -16,7 +16,7 @@ #include <boost/date_time/posix_time/posix_time.hpp> #include <factory.impl.h> -typedef boost::filesystem::directory_iterator DirEnt; +typedef std::filesystem::directory_iterator DirEnt; NAMEDFACTORY("fsrows", FsRows, RowSetFactory); @@ -39,7 +39,7 @@ const Columns FsRows::SearchState::col(defCols()); bool FsRows::SpecBase::recurse(const SearchState *, ExecContext *) const { return true; } bool FsRows::SpecBase::matches(const SearchState *, ExecContext *) const { return true; } -const boost::filesystem::path & FsRows::SpecBase::curPath(const SearchState * fs) const { return fs->curPath; } +const std::filesystem::path & FsRows::SpecBase::curPath(const SearchState * fs) const { return fs->curPath; } unsigned int FsRows::SpecBase::depth(const SearchState * fs) const { return fs->depth; } const struct stat & FsRows::SpecBase::curStat(const SearchState * fs) const { return fs->curStat; } @@ -113,7 +113,7 @@ FsRows::execute(SearchState & ss, const Path & dir, const RowProcessorCallback & } } } - catch (const boost::filesystem::filesystem_error & e) { + catch (const std::filesystem::filesystem_error & e) { if (!ignoreErrors(ec)) { throw; } diff --git a/project2/files/fsRows.h b/project2/files/fsRows.h index 6e8ff5b..b8fdac8 100644 --- a/project2/files/fsRows.h +++ b/project2/files/fsRows.h @@ -1,7 +1,7 @@ #ifndef FSROWS_H #define FSROWS_H -#include <boost/filesystem/path.hpp> +#include <filesystem> #include <sys/stat.h> #include "variables.h" #include "rowSet.h" @@ -20,7 +20,7 @@ class DLL_PUBLIC FsRows : public RowSet { virtual bool recurse(const SearchState * fs, ExecContext *) const; virtual bool matches(const SearchState * fs, ExecContext *) const; protected: - const boost::filesystem::path & curPath(const SearchState * fs) const; + const std::filesystem::path & curPath(const SearchState * fs) const; unsigned int depth(const SearchState * fs) const; const struct stat & curStat(const SearchState * fs) const; }; @@ -29,7 +29,7 @@ class DLL_PUBLIC FsRows : public RowSet { typedef AdHoc::Factory<SpecBase, const Glib::ustring &> SpecBaseStringFactory; typedef ANONSTORAGEOF(SpecBase) SpecBases; typedef std::list<Glib::ustring> SpecSpec; - typedef boost::filesystem::path Path; + typedef std::filesystem::path Path; FsRows(ScriptNodePtr p); ~FsRows(); @@ -41,7 +41,7 @@ class DLL_PUBLIC FsRows : public RowSet { void execute(const Glib::ustring &, const RowProcessorCallback &, ExecContext *) const; class SearchState : public RowState { public: - SearchState(const boost::filesystem::path & r); + SearchState(const std::filesystem::path & r); virtual RowAttribute resolveAttr(const Glib::ustring & attrName) const; virtual void foreachAttr(const AttrAction & action) const; @@ -58,8 +58,8 @@ class DLL_PUBLIC FsRows : public RowSet { static const Columns col; SpecBases specs; - const boost::filesystem::path fsRoot; - boost::filesystem::path curPath; + const std::filesystem::path fsRoot; + std::filesystem::path curPath; Glib::ustring curPathStr; unsigned int depth; struct stat curStat; diff --git a/project2/files/functions/pwd.cpp b/project2/files/functions/pwd.cpp index af06fe7..ade7702 100644 --- a/project2/files/functions/pwd.cpp +++ b/project2/files/functions/pwd.cpp @@ -2,7 +2,7 @@ #include <variables.h> #include <scriptLoader.h> #include <scripts.h> -#include <boost/filesystem/operations.hpp> +#include <filesystem> /// Variable implementation to access session contents class Pwd : public VariableImplDyn { @@ -13,7 +13,7 @@ class Pwd : public VariableImplDyn { } VariableType value(ExecContext *) const { - return boost::filesystem::current_path().string(); + return std::filesystem::current_path().string(); } }; NAMEDFACTORY("pwd", Pwd, VariableFactory); diff --git a/project2/files/optionsSource.cpp b/project2/files/optionsSource.cpp index ae7562e..9172834 100644 --- a/project2/files/optionsSource.cpp +++ b/project2/files/optionsSource.cpp @@ -1,5 +1,5 @@ #include <pch.hpp> -#include <boost/filesystem/convenience.hpp> +#include <filesystem> #include "optionsSource.h" #define yyFlexLexer configBaseFlexLexer #include <FlexLexer.h> @@ -7,15 +7,15 @@ #include <boost/shared_ptr.hpp> #include <fstream> -FileOptions::FileOptions(const boost::filesystem::path & f) : - file(boost::filesystem::absolute(f)) +FileOptions::FileOptions(const std::filesystem::path & f) : + file(std::filesystem::absolute(f)) { } void FileOptions::loadInto(const ConfigConsumer & consume, const Options::CurrentPlatform & platform) const { - if (boost::filesystem::exists(file)) { + if (std::filesystem::exists(file)) { std::ifstream in(file.string()); if (!in.good()) { throw std::runtime_error("Couldn't open configuration file " + file.string()); @@ -29,11 +29,12 @@ boost::posix_time::ptime FileOptions::modifiedTime() const { return boost::posix_time::from_time_t( - boost::filesystem::exists(file) ? - std::max( - boost::filesystem::last_write_time(file), - boost::filesystem::last_write_time(file.parent_path())) : - boost::filesystem::last_write_time(file.parent_path())); + std::chrono::system_clock::to_time_t( + std::filesystem::exists(file) ? + std::max( + std::filesystem::last_write_time(file), + std::filesystem::last_write_time(file.parent_path())) : + std::filesystem::last_write_time(file.parent_path()))); } FileOptions::ExtraFileOptions FileOptions::extraFileOptions; diff --git a/project2/files/optionsSource.h b/project2/files/optionsSource.h index 337f6b2..121b3f3 100644 --- a/project2/files/optionsSource.h +++ b/project2/files/optionsSource.h @@ -3,7 +3,7 @@ #include "../common/optionsSource.h" #include "../common/options.h" -#include <boost/filesystem/path.hpp> +#include <filesystem> #include <visibility.h> class FileOptions; @@ -11,14 +11,14 @@ typedef std::shared_ptr<FileOptions> FileOptionsPtr; class DLL_PUBLIC FileOptions : public OptionsSource { public: - FileOptions(const boost::filesystem::path & file); + FileOptions(const std::filesystem::path & file); void loadInto(const ConfigConsumer & consume, const Options::CurrentPlatform & platform) const override; boost::posix_time::ptime modifiedTime() const override; INITOPTIONS; private: - const boost::filesystem::path file; + const std::filesystem::path file; typedef std::map<std::string, FileOptionsPtr> ExtraFileOptions; static ExtraFileOptions extraFileOptions; diff --git a/project2/files/pch.hpp b/project2/files/pch.hpp index 91c45d8..daaaf3b 100644 --- a/project2/files/pch.hpp +++ b/project2/files/pch.hpp @@ -3,8 +3,7 @@ #define FILES_PCH #include <boost/bind.hpp> -#include <boost/filesystem/operations.hpp> -#include <boost/filesystem/path.hpp> +#include <filesystem> #include <boost/intrusive_ptr.hpp> #include <boost/variant/variant_fwd.hpp> diff --git a/project2/files/presenterCache.cpp b/project2/files/presenterCache.cpp index d0b6df2..c176d17 100644 --- a/project2/files/presenterCache.cpp +++ b/project2/files/presenterCache.cpp @@ -8,8 +8,7 @@ #include <sys/stat.h> #include <boost/iostreams/device/file_descriptor.hpp> #include <boost/iostreams/stream.hpp> -#include <boost/filesystem/path.hpp> -#include <boost/filesystem/operations.hpp> +#include <filesystem> #include <boost/bind.hpp> #include <boost/tuple/tuple_comparison.hpp> #include <glibmm/convert.h> @@ -198,12 +197,12 @@ class FilePresenterCache : public PresenterCache { openCaches[key] = c; return c; } - boost::filesystem::path getCacheFile(ExecContext * ec) const + std::filesystem::path getCacheFile(ExecContext * ec) const { - boost::filesystem::path cache; + std::filesystem::path cache; cache = Store; cache /= idProvider->value(ec).as<std::string>(); - boost::filesystem::create_directories(cache); + std::filesystem::create_directories(cache); cache /= FileName; return cache; } @@ -213,7 +212,7 @@ class FilePresenterCache : public PresenterCache { cache->insert(Parameters::value_type(n, v)); } - static void appendPath(boost::filesystem::path * cache, const std::string & n, const VariableType & v) + static void appendPath(std::filesystem::path * cache, const std::string & n, const VariableType & v) { *cache /= n; *cache /= v.operator const std::string &(); @@ -224,14 +223,14 @@ class FilePresenterCache : public PresenterCache { Variable::VariableImplPtr idProvider; // Config - static boost::filesystem::path Store; + static std::filesystem::path Store; static std::string FileName; static std::string Provider; static time_t CacheLife; friend class FilePresenterCacheFactory; }; FilePresenterCache::OpenCaches FilePresenterCache::openCaches; -boost::filesystem::path FilePresenterCache::Store; +std::filesystem::path FilePresenterCache::Store; std::string FilePresenterCache::FileName; std::string FilePresenterCache::Provider; time_t FilePresenterCache::CacheLife; @@ -257,7 +256,7 @@ class FilePresenterCacheFactory : public LifeCycle { void onIdle() override { try { - if (boost::filesystem::is_directory(FilePresenterCache::Store)) { + if (std::filesystem::is_directory(FilePresenterCache::Store)) { emptyDir(FilePresenterCache::Store); } } @@ -272,11 +271,11 @@ class FilePresenterCacheFactory : public LifeCycle { FilePresenterCache::openCaches.clear(); } - bool emptyDir(const boost::filesystem::path & dir) + bool emptyDir(const std::filesystem::path & dir) { bool files = false; - boost::filesystem::directory_iterator end; - for (boost::filesystem::directory_iterator itr(dir); itr != end; ++itr) { + std::filesystem::directory_iterator end; + for (std::filesystem::directory_iterator itr(dir); itr != end; ++itr) { struct stat st; stat(itr->path().string().c_str(), &st); if (S_ISDIR(st.st_mode)) { @@ -284,7 +283,7 @@ class FilePresenterCacheFactory : public LifeCycle { files = true; } else { - boost::filesystem::remove(*itr); + std::filesystem::remove(*itr); } } else { @@ -292,7 +291,7 @@ class FilePresenterCacheFactory : public LifeCycle { files = true; } else { - boost::filesystem::remove(*itr); + std::filesystem::remove(*itr); } } } diff --git a/project2/files/unittests/Jamfile.jam b/project2/files/unittests/Jamfile.jam index 236938d..ec821d6 100644 --- a/project2/files/unittests/Jamfile.jam +++ b/project2/files/unittests/Jamfile.jam @@ -1,7 +1,6 @@ import testing ; -lib boost_system ; -lib boost_filesystem ; +lib stdc++fs ; path-constant me : . ; @@ -11,7 +10,7 @@ run <library>..//p2files <library>../../ut//p2ut <library>../../common//p2common - <library>boost_filesystem + <library>stdc++fs <define>ROOT=\"$(me)\" <dependency>test.config : testConfig ; diff --git a/project2/files/unittests/testConfig.cpp b/project2/files/unittests/testConfig.cpp index 2933f9b..995b07e 100644 --- a/project2/files/unittests/testConfig.cpp +++ b/project2/files/unittests/testConfig.cpp @@ -39,7 +39,7 @@ BOOST_AUTO_TEST_CASE( readMissingFile ) BOOST_AUTO_TEST_CASE( readConfigFile ) { TestConfigConsumer options; - BOOST_REQUIRE(boost::filesystem::exists(rootDir / "test.config")); + BOOST_REQUIRE(std::filesystem::exists(rootDir / "test.config")); OptionsSourcePtr file = OptionsSourcePtr(new FileOptions(rootDir / "test.config")); file->loadInto(options, []() { return Glib::ustring(); }); // Count diff --git a/project2/ice/Jamfile.jam b/project2/ice/Jamfile.jam index 001ee8f..c7fe77c 100644 --- a/project2/ice/Jamfile.jam +++ b/project2/ice/Jamfile.jam @@ -8,7 +8,7 @@ lib mcpp ; lib Ice : : <name>Ice++11 ; lib IceBox : : <name>IceBox++11 ; lib pthread ; -lib boost_filesystem ; +lib stdc++fs ; lib slicer : : : : <include>/usr/include/slicer ; lib slicer-compiler : : : : <include>/usr/include/slicer ; @@ -32,7 +32,7 @@ lib p2iceclient : <library>dl <library>Ice <library>slice//Slice - <library>boost_filesystem + <library>stdc++fs <library>pthread : : <library>p2ice @@ -52,7 +52,7 @@ lib p2icedaemon : <library>dl <library>Ice <library>slice//Slice - <library>boost_filesystem + <library>stdc++fs <library>pthread : : <library>../daemon/lib//p2daemonlib @@ -90,7 +90,7 @@ lib p2ice : <library>slice//Slice <library>slicer <library>slicer-compiler - <library>boost_filesystem + <library>stdc++fs <library>pthread : : <linkflags>-rdynamic diff --git a/project2/ice/buildClient.cpp b/project2/ice/buildClient.cpp index 97655c7..f454373 100644 --- a/project2/ice/buildClient.cpp +++ b/project2/ice/buildClient.cpp @@ -3,7 +3,7 @@ #include "slice2Task.h" #include "slice2Rows.h" -BuildClient::BuildClient(const boost::filesystem::path & slice, const IceCompile::Deps & dep) : +BuildClient::BuildClient(const std::filesystem::path & slice, const IceCompile::Deps & dep) : SliceCompile(slice, dep) { } @@ -26,7 +26,7 @@ BuildClient::Body(FILE * out, Slice::UnitPtr u) const return taskBuilder.Components() + rowsBuilder.Components(); } -boost::filesystem::path +std::filesystem::path BuildClient::OutputName(const std::string & type) const { return slice.filename().replace_extension(".client" + type); diff --git a/project2/ice/buildClient.h b/project2/ice/buildClient.h index e16872e..a6f6ef1 100644 --- a/project2/ice/buildClient.h +++ b/project2/ice/buildClient.h @@ -6,12 +6,12 @@ class BuildClient : public SliceCompile { public: - BuildClient(const boost::filesystem::path & slice, const IceCompile::Deps & dep); + BuildClient(const std::filesystem::path & slice, const IceCompile::Deps & dep); virtual void Headers(FILE *) const; virtual unsigned int Body(FILE *, Slice::UnitPtr) const; - boost::filesystem::path OutputName(const std::string & type) const; + std::filesystem::path OutputName(const std::string & type) const; }; #endif diff --git a/project2/ice/buildComms.cpp b/project2/ice/buildComms.cpp index 21d89a5..0ccef74 100644 --- a/project2/ice/buildComms.cpp +++ b/project2/ice/buildComms.cpp @@ -2,12 +2,12 @@ #include "buildComms.h" #include <logger.h> #include <buffer.h> -#include <boost/filesystem/operations.hpp> +#include <filesystem> #include <slicer/parser.h> -namespace fs = boost::filesystem; +namespace fs = std::filesystem; -BuildComms::BuildComms(const boost::filesystem::path & slice, bool ip, bool sp) : +BuildComms::BuildComms(const std::filesystem::path & slice, bool ip, bool sp) : IceCompile(slice), iceParts(ip), slicerParts(sp) @@ -15,7 +15,7 @@ BuildComms::BuildComms(const boost::filesystem::path & slice, bool ip, bool sp) } unsigned int -BuildComms::Count(const boost::filesystem::path & in) const +BuildComms::Count(const std::filesystem::path & in) const { unsigned int components = 0; @@ -33,7 +33,7 @@ BuildComms::Count(const boost::filesystem::path & in) const } unsigned int -BuildComms::Build(const boost::filesystem::path & in, const boost::filesystem::path & out) const +BuildComms::Build(const std::filesystem::path & in, const std::filesystem::path & out) const { const auto slicecmd = stringbf("%s --output-dir %s --dll-export JAM_DLL_PUBLIC %s", slice2cpp, out.parent_path(), in); Logger()->messagebf(LOG_DEBUG, "%s: slice command: %s", __PRETTY_FUNCTION__, slicecmd); @@ -58,13 +58,13 @@ BuildComms::Build(const boost::filesystem::path & in, const boost::filesystem::p return components; } -boost::filesystem::path +std::filesystem::path BuildComms::InputPath() const { return slice; } -boost::filesystem::path +std::filesystem::path BuildComms::OutputName(const std::string & type) const { return slice.filename().replace_extension(type); diff --git a/project2/ice/buildComms.h b/project2/ice/buildComms.h index efce380..4f541b5 100644 --- a/project2/ice/buildComms.h +++ b/project2/ice/buildComms.h @@ -6,12 +6,12 @@ class BuildComms : public IceCompile { public: - BuildComms(const boost::filesystem::path & slice, bool iceParts, bool slicerParts); + BuildComms(const std::filesystem::path & slice, bool iceParts, bool slicerParts); - unsigned int Build(const boost::filesystem::path & in, const boost::filesystem::path & out) const; - unsigned int Count(const boost::filesystem::path & in) const; - boost::filesystem::path InputPath() const; - boost::filesystem::path OutputName(const std::string & type) const; + unsigned int Build(const std::filesystem::path & in, const std::filesystem::path & out) const; + unsigned int Count(const std::filesystem::path & in) const; + std::filesystem::path InputPath() const; + std::filesystem::path OutputName(const std::string & type) const; const bool iceParts; const bool slicerParts; diff --git a/project2/ice/buildDaemon.cpp b/project2/ice/buildDaemon.cpp index 5bb4cfd..6f7138b 100644 --- a/project2/ice/buildDaemon.cpp +++ b/project2/ice/buildDaemon.cpp @@ -2,7 +2,7 @@ #include "buildDaemon.h" #include "slice2Daemon.h" -BuildDaemon::BuildDaemon(const boost::filesystem::path & slice, const IceCompile::Deps & dep) : +BuildDaemon::BuildDaemon(const std::filesystem::path & slice, const IceCompile::Deps & dep) : SliceCompile(slice, dep) { } @@ -22,7 +22,7 @@ BuildDaemon::Body(FILE * out, Slice::UnitPtr u) const return daemonBuilder.Components(); } -boost::filesystem::path +std::filesystem::path BuildDaemon::OutputName(const std::string & type) const { return slice.filename().replace_extension(".daemon" + type); diff --git a/project2/ice/buildDaemon.h b/project2/ice/buildDaemon.h index b2dd8ca..47ba77a 100644 --- a/project2/ice/buildDaemon.h +++ b/project2/ice/buildDaemon.h @@ -6,12 +6,12 @@ class BuildDaemon : public SliceCompile { public: - BuildDaemon(const boost::filesystem::path & slice, const IceCompile::Deps & dep); + BuildDaemon(const std::filesystem::path & slice, const IceCompile::Deps & dep); virtual void Headers(FILE *) const; virtual unsigned int Body(FILE *, Slice::UnitPtr) const; - boost::filesystem::path OutputName(const std::string & type) const; + std::filesystem::path OutputName(const std::string & type) const; }; #endif diff --git a/project2/ice/iceCompile.cpp b/project2/ice/iceCompile.cpp index 6f52e1b..eee0463 100644 --- a/project2/ice/iceCompile.cpp +++ b/project2/ice/iceCompile.cpp @@ -1,11 +1,11 @@ #include <pch.hpp> #include "iceCompile.h" -#include <boost/filesystem/operations.hpp> +#include <filesystem> #include <logger.h> #include <buffer.h> #include <dlfcn.h> -namespace fs = boost::filesystem; +namespace fs = std::filesystem; std::string IceCompile::slice2cpp; std::string IceCompile::slicer; @@ -38,13 +38,13 @@ DECLARE_OPTIONS(IceCompile, "ICE Compile Options") "The root folder where Slicer header files are found") END_OPTIONS(IceCompile); -IceCompile::IceCompile(const boost::filesystem::path & s) : +IceCompile::IceCompile(const std::filesystem::path & s) : slice(s), components(0) { } -IceCompile::IceCompile(const boost::filesystem::path & s, const Deps & d) : +IceCompile::IceCompile(const std::filesystem::path & s, const Deps & d) : slice(s), components(0), deps(d) diff --git a/project2/ice/iceCompile.h b/project2/ice/iceCompile.h index c06f8b1..d771231 100644 --- a/project2/ice/iceCompile.h +++ b/project2/ice/iceCompile.h @@ -4,7 +4,7 @@ #include "options.h" #include <string> #include <set> -#include <boost/filesystem/path.hpp> +#include <filesystem> #include <boost/optional.hpp> class IceCompile { @@ -21,12 +21,12 @@ class IceCompile { static std::string linker; static std::string cxxopts; static std::string linkeropts; - static boost::filesystem::path tmpdir; - static boost::filesystem::path headerdir; - static boost::filesystem::path slicerheaderdir; + static std::filesystem::path tmpdir; + static std::filesystem::path headerdir; + static std::filesystem::path slicerheaderdir; - IceCompile(const boost::filesystem::path & slice); - IceCompile(const boost::filesystem::path & slice, const Deps & deps); + IceCompile(const std::filesystem::path & slice); + IceCompile(const std::filesystem::path & slice, const Deps & deps); enum Steps { UpdateBuild = 0x1, @@ -36,29 +36,29 @@ class IceCompile { /// Conditionally execute Build, Compile, Link as required void Update(int steps = UpdateBuild | UpdateCompile | UpdateLink); /// Source file path (e.g. /some/path/slice.ice) - virtual boost::filesystem::path InputPath() const = 0; + virtual std::filesystem::path InputPath() const = 0; /// File name (no extension) in temporary directory (e.g. clientSlice) - virtual boost::filesystem::path OutputName(const std::string & type) const = 0; + virtual std::filesystem::path OutputName(const std::string & type) const = 0; typedef boost::shared_ptr<void> LibHandle; typedef std::set<LibHandle> LibHandles; LibHandles Open() const; protected: - virtual unsigned int Build(const boost::filesystem::path & in, const boost::filesystem::path & out) const = 0; - virtual unsigned int Count(const boost::filesystem::path & in) const = 0; - void BuildInteral(const boost::filesystem::path & in, const boost::filesystem::path & out); - void Compile(const boost::filesystem::path & in, const boost::filesystem::path & out); - void Link(const boost::filesystem::path & in, const boost::filesystem::path & out); + virtual unsigned int Build(const std::filesystem::path & in, const std::filesystem::path & out) const = 0; + virtual unsigned int Count(const std::filesystem::path & in) const = 0; + void BuildInteral(const std::filesystem::path & in, const std::filesystem::path & out); + void Compile(const std::filesystem::path & in, const std::filesystem::path & out); + void Link(const std::filesystem::path & in, const std::filesystem::path & out); - typedef void (IceCompile::*UpdateFunc)(const boost::filesystem::path & in, const boost::filesystem::path & out); - typedef void (IceCompile::*CountFunc)(const boost::filesystem::path & in); - void update(const boost::filesystem::path & in, const boost::filesystem::path & out, UpdateFunc func, CountFunc count = NULL); + typedef void (IceCompile::*UpdateFunc)(const std::filesystem::path & in, const std::filesystem::path & out); + typedef void (IceCompile::*CountFunc)(const std::filesystem::path & in); + void update(const std::filesystem::path & in, const std::filesystem::path & out, UpdateFunc func, CountFunc count = NULL); - const boost::filesystem::path slice; + const std::filesystem::path slice; private: - void countComponents(const boost::filesystem::path & in); + void countComponents(const std::filesystem::path & in); unsigned int components; LibHandle OpenLib() const; const Deps deps; diff --git a/project2/ice/iceDaemon.cpp b/project2/ice/iceDaemon.cpp index 2330d02..4d0e091 100644 --- a/project2/ice/iceDaemon.cpp +++ b/project2/ice/iceDaemon.cpp @@ -7,7 +7,7 @@ #include <scriptLoader.h> #include <options.h> #include <sys/stat.h> -#include <boost/filesystem.hpp> +#include <filesystem> #include <boost/lexical_cast.hpp> #include <commonObjects.h> #include <logger.h> diff --git a/project2/ice/pch.hpp b/project2/ice/pch.hpp index 1268e36..5c1187c 100644 --- a/project2/ice/pch.hpp +++ b/project2/ice/pch.hpp @@ -3,7 +3,7 @@ #define CGI_PCH #include <Ice/Ice.h> -#include <boost/filesystem.hpp> +#include <filesystem> #include <boost/function/function_fwd.hpp> #include <boost/optional.hpp> #include <map> diff --git a/project2/ice/sliceCompile.cpp b/project2/ice/sliceCompile.cpp index 53832c9..83b5e65 100644 --- a/project2/ice/sliceCompile.cpp +++ b/project2/ice/sliceCompile.cpp @@ -5,13 +5,13 @@ std::mutex slicePreprocessor; -SliceCompile::SliceCompile(const boost::filesystem::path & slice, const IceCompile::Deps & dep) : +SliceCompile::SliceCompile(const std::filesystem::path & slice, const IceCompile::Deps & dep) : IceCompile(slice, dep) { } unsigned int -SliceCompile::build(const boost::filesystem::path & in, FILE * out) const +SliceCompile::build(const std::filesystem::path & in, FILE * out) const { std::vector<std::string> cppArgs; std::lock_guard<std::mutex> lock(slicePreprocessor); @@ -47,7 +47,7 @@ SliceCompile::build(const boost::filesystem::path & in, FILE * out) const } unsigned int -SliceCompile::Build(const boost::filesystem::path & in, const boost::filesystem::path & outpath) const +SliceCompile::Build(const std::filesystem::path & in, const std::filesystem::path & outpath) const { FILE * out = fopen(outpath.string().c_str(), "w"); if (!out) { @@ -64,7 +64,7 @@ SliceCompile::Build(const boost::filesystem::path & in, const boost::filesystem: } unsigned int -SliceCompile::Count(const boost::filesystem::path & in) const +SliceCompile::Count(const std::filesystem::path & in) const { return build(in, NULL); } @@ -74,7 +74,7 @@ SliceCompile::Headers(FILE *) const { } -boost::filesystem::path +std::filesystem::path SliceCompile::InputPath() const { return slice; diff --git a/project2/ice/sliceCompile.h b/project2/ice/sliceCompile.h index db4127b..39d7948 100644 --- a/project2/ice/sliceCompile.h +++ b/project2/ice/sliceCompile.h @@ -9,17 +9,17 @@ class DLL_PUBLIC SliceCompile : public IceCompile { public: - SliceCompile(const boost::filesystem::path & slice, const IceCompile::Deps & dep); + SliceCompile(const std::filesystem::path & slice, const IceCompile::Deps & dep); - unsigned int Count(const boost::filesystem::path & in) const; - unsigned int Build(const boost::filesystem::path & in, const boost::filesystem::path & out) const; + unsigned int Count(const std::filesystem::path & in) const; + unsigned int Build(const std::filesystem::path & in, const std::filesystem::path & out) const; virtual void Headers(FILE *) const; virtual unsigned int Body(FILE *, Slice::UnitPtr) const = 0; - boost::filesystem::path InputPath() const; + std::filesystem::path InputPath() const; private: - unsigned int build(const boost::filesystem::path & in, FILE *) const; + unsigned int build(const std::filesystem::path & in, FILE *) const; }; #endif diff --git a/project2/ice/unittests/Jamfile.jam b/project2/ice/unittests/Jamfile.jam index c78d9e5..d8a0220 100644 --- a/project2/ice/unittests/Jamfile.jam +++ b/project2/ice/unittests/Jamfile.jam @@ -54,7 +54,7 @@ run <library>../../ut//p2ut <library>../../basics//p2basics <library>..//Ice - <library>..//boost_filesystem + <library>..//stdc++fs <dependency>testClient.xml : testClientCompile : @@ -73,7 +73,7 @@ run <library>../../xml//p2xml <library>../../basics//p2basics <library>..//Ice - <library>..//boost_filesystem + <library>..//stdc++fs <dependency>testClient.xml : testClient : @@ -90,7 +90,7 @@ run <library>../../ut//p2ut <library>../../basics//p2basics <library>..//Ice - <library>..//boost_filesystem + <library>..//stdc++fs : testDaemonCompile : ; @@ -108,7 +108,7 @@ run <library>../../xml//p2xml <library>../../basics//p2basics <library>..//Ice - <library>..//boost_filesystem + <library>..//stdc++fs <dependency>data/unittest-data.xml <dependency>lib/testrows.xml <dependency>tasks/UnitTest/SimpleInterface/SomeTask.xml diff --git a/project2/ice/unittests/testClient.cpp b/project2/ice/unittests/testClient.cpp index 5abedd7..814a4d4 100644 --- a/project2/ice/unittests/testClient.cpp +++ b/project2/ice/unittests/testClient.cpp @@ -1,6 +1,6 @@ #define BOOST_TEST_MODULE Client #include <boost/test/unit_test.hpp> -#include <boost/filesystem/operations.hpp> +#include <filesystem> #include "iceClient.h" #include <Ice/ObjectAdapter.h> #include <Ice/Service.h> @@ -17,8 +17,8 @@ #define XSTR(s) STR(s) #define STR(s) #s -const auto bindir = boost::filesystem::canonical("/proc/self/exe").parent_path(); -const boost::filesystem::path iceroot(XSTR(ROOT)); +const auto bindir = std::filesystem::canonical("/proc/self/exe").parent_path(); +const std::filesystem::path iceroot(XSTR(ROOT)); const auto headers = iceroot.parent_path().parent_path(); BOOST_TEST_DONT_PRINT_LOG_VALUE( ::UnitTestComplex::Date ); @@ -150,24 +150,24 @@ unloadTests() BOOST_REQUIRE_THROW(RowSetFactory::get("UnitTestComplex-ComplexInterface-ComplexRow"), AdHoc::NoSuchPluginException); } -void test_client_run(ExecContext *, const boost::filesystem::path & tmpdir); +void test_client_run(ExecContext *, const std::filesystem::path & tmpdir); BOOST_FIXTURE_TEST_SUITE( Core, TestAppInstance ); BOOST_AUTO_TEST_CASE( test_client ) { - const boost::filesystem::path tmpdir = "/tmp/ut/project2.slice-client"; + const std::filesystem::path tmpdir = "/tmp/ut/project2.slice-client"; BOOST_TEST_CHECKPOINT("Clean up"); - boost::filesystem::remove_all(tmpdir); + std::filesystem::remove_all(tmpdir); test_client_run(this, tmpdir); test_client_run(this, tmpdir); - boost::filesystem::remove_all(tmpdir); + std::filesystem::remove_all(tmpdir); } BOOST_AUTO_TEST_SUITE_END(); -void test_client_run(ExecContext * ec, const boost::filesystem::path & tmpdir) +void test_client_run(ExecContext * ec, const std::filesystem::path & tmpdir) { BOOST_TEST_CHECKPOINT("Configure, compile, link, load"); TestOptionsSource::LoadTestOptions({ @@ -178,16 +178,16 @@ void test_client_run(ExecContext * ec, const boost::filesystem::path & tmpdir) { "ice.client.slicerclient", (iceroot / "unittestTypes.ice").string() }, { "ice.client.slicerclient", (iceroot / "unittest.ice").string() } }); - BOOST_REQUIRE(!boost::filesystem::exists(tmpdir / "unittest.so")); - BOOST_REQUIRE(boost::filesystem::exists(tmpdir / "unittest.client.so")); - BOOST_REQUIRE(!boost::filesystem::exists(tmpdir / "unittestTypes.so")); - BOOST_REQUIRE(!boost::filesystem::exists(tmpdir / "unittestTypes.client.so")); - BOOST_REQUIRE(!boost::filesystem::exists(tmpdir / "unittestComplex.so")); - BOOST_REQUIRE(boost::filesystem::exists(tmpdir / "unittestComplex.client.so")); + BOOST_REQUIRE(!std::filesystem::exists(tmpdir / "unittest.so")); + BOOST_REQUIRE(std::filesystem::exists(tmpdir / "unittest.client.so")); + BOOST_REQUIRE(!std::filesystem::exists(tmpdir / "unittestTypes.so")); + BOOST_REQUIRE(!std::filesystem::exists(tmpdir / "unittestTypes.client.so")); + BOOST_REQUIRE(!std::filesystem::exists(tmpdir / "unittestComplex.so")); + BOOST_REQUIRE(std::filesystem::exists(tmpdir / "unittestComplex.client.so")); commonTests(ec); TestOptionsSource::LoadTestOptions({ }); unloadTests(); - boost::filesystem::remove_all(tmpdir); + std::filesystem::remove_all(tmpdir); } diff --git a/project2/ice/unittests/testClientCompile.cpp b/project2/ice/unittests/testClientCompile.cpp index 89b0b4b..72df095 100644 --- a/project2/ice/unittests/testClientCompile.cpp +++ b/project2/ice/unittests/testClientCompile.cpp @@ -1,6 +1,6 @@ #define BOOST_TEST_MODULE ClientCompile #include <boost/test/unit_test.hpp> -#include <boost/filesystem/operations.hpp> +#include <filesystem> #include "iceClient.h" #include <testOptionsSource.h> #include <task.h> @@ -11,8 +11,8 @@ #define XSTR(s) STR(s) #define STR(s) #s -const auto bindir = boost::filesystem::canonical("/proc/self/exe").parent_path(); -const boost::filesystem::path iceroot(XSTR(ROOT)); +const auto bindir = std::filesystem::canonical("/proc/self/exe").parent_path(); +const std::filesystem::path iceroot(XSTR(ROOT)); const auto headers = iceroot.parent_path().parent_path(); static @@ -45,9 +45,9 @@ BOOST_AUTO_TEST_CASE( compile_client_full ) { TestOptionsSource::LoadTestOptions({ }); - const boost::filesystem::path tmpdir = "/tmp/ut/project2.slice-clientCompile/full"; + const std::filesystem::path tmpdir = "/tmp/ut/project2.slice-clientCompile/full"; BOOST_TEST_CHECKPOINT("Clean up"); - boost::filesystem::remove_all(tmpdir); + std::filesystem::remove_all(tmpdir); BOOST_TEST_CHECKPOINT("Configure, compile, link, load"); TestOptionsSource::LoadTestOptions({ @@ -57,22 +57,22 @@ BOOST_AUTO_TEST_CASE( compile_client_full ) { "ice.client.slice", (iceroot / "unittestTypes.ice").string() }, { "ice.client.slice", (iceroot / "unittest.ice").string() } }); - BOOST_REQUIRE(boost::filesystem::exists(tmpdir / "unittest.so")); - BOOST_REQUIRE(boost::filesystem::exists(tmpdir / "unittest.client.so")); - BOOST_REQUIRE(boost::filesystem::exists(tmpdir / "unittestTypes.so")); - BOOST_REQUIRE(!boost::filesystem::exists(tmpdir / "unittestTypes.client.so")); + BOOST_REQUIRE(std::filesystem::exists(tmpdir / "unittest.so")); + BOOST_REQUIRE(std::filesystem::exists(tmpdir / "unittest.client.so")); + BOOST_REQUIRE(std::filesystem::exists(tmpdir / "unittestTypes.so")); + BOOST_REQUIRE(!std::filesystem::exists(tmpdir / "unittestTypes.client.so")); commonTests(); TestOptionsSource::LoadTestOptions({ }); unloadTests(); - boost::filesystem::remove_all(tmpdir); + std::filesystem::remove_all(tmpdir); } BOOST_AUTO_TEST_CASE( compile_client_clientOnly ) { - const boost::filesystem::path tmpdir = "/tmp/ut/project2.slice-clientCompile/clientOnly"; + const std::filesystem::path tmpdir = "/tmp/ut/project2.slice-clientCompile/clientOnly"; BOOST_TEST_CHECKPOINT("Clean up"); - boost::filesystem::remove_all(tmpdir); + std::filesystem::remove_all(tmpdir); BOOST_TEST_CHECKPOINT("Configure, compile, link, load"); TestOptionsSource::LoadTestOptions({ @@ -83,23 +83,23 @@ BOOST_AUTO_TEST_CASE( compile_client_clientOnly ) { "ice.client.sliceclient", (iceroot / "unittestTypes.ice").string() }, { "ice.client.sliceclient", (iceroot / "unittest.ice").string() } }); - BOOST_REQUIRE(!boost::filesystem::exists(tmpdir / "unittest.so")); - BOOST_REQUIRE(boost::filesystem::exists(tmpdir / "unittest.client.so")); - BOOST_REQUIRE(boost::filesystem::exists(tmpdir / "unittestTypes.so")); - BOOST_REQUIRE(!boost::filesystem::exists(tmpdir / "unittestTypes.client.so")); + BOOST_REQUIRE(!std::filesystem::exists(tmpdir / "unittest.so")); + BOOST_REQUIRE(std::filesystem::exists(tmpdir / "unittest.client.so")); + BOOST_REQUIRE(std::filesystem::exists(tmpdir / "unittestTypes.so")); + BOOST_REQUIRE(!std::filesystem::exists(tmpdir / "unittestTypes.client.so")); commonTests(); TestOptionsSource::LoadTestOptions({ }); unloadTests(); - boost::filesystem::remove_all(tmpdir); + std::filesystem::remove_all(tmpdir); } BOOST_AUTO_TEST_CASE( compile_client_slicer ) { TestOptionsSource::LoadTestOptions({ }); - const boost::filesystem::path tmpdir = "/tmp/ut/project2.slice-clientCompile/slicer"; + const std::filesystem::path tmpdir = "/tmp/ut/project2.slice-clientCompile/slicer"; BOOST_TEST_CHECKPOINT("Clean up"); - boost::filesystem::remove_all(tmpdir); + std::filesystem::remove_all(tmpdir); BOOST_TEST_CHECKPOINT("Configure, compile, link, load"); TestOptionsSource::LoadTestOptions({ @@ -110,15 +110,15 @@ BOOST_AUTO_TEST_CASE( compile_client_slicer ) { "ice.client.slicerclient", (iceroot / "unittestTypes.ice").string() }, { "ice.client.slicerclient", (iceroot / "unittest.ice").string() } }); - BOOST_REQUIRE(!boost::filesystem::exists(tmpdir / "unittest.so")); - BOOST_REQUIRE(boost::filesystem::exists(tmpdir / "unittest.client.so")); - BOOST_REQUIRE(!boost::filesystem::exists(tmpdir / "unittestTypes.so")); - BOOST_REQUIRE(!boost::filesystem::exists(tmpdir / "unittestTypes.client.so")); + BOOST_REQUIRE(!std::filesystem::exists(tmpdir / "unittest.so")); + BOOST_REQUIRE(std::filesystem::exists(tmpdir / "unittest.client.so")); + BOOST_REQUIRE(!std::filesystem::exists(tmpdir / "unittestTypes.so")); + BOOST_REQUIRE(!std::filesystem::exists(tmpdir / "unittestTypes.client.so")); commonTests(); TestOptionsSource::LoadTestOptions({ }); unloadTests(); - boost::filesystem::remove_all(tmpdir); + std::filesystem::remove_all(tmpdir); } BOOST_AUTO_TEST_SUITE_END(); diff --git a/project2/ice/unittests/testDaemon.cpp b/project2/ice/unittests/testDaemon.cpp index 08eefd0..0ce5fa2 100644 --- a/project2/ice/unittests/testDaemon.cpp +++ b/project2/ice/unittests/testDaemon.cpp @@ -1,6 +1,6 @@ #define BOOST_TEST_MODULE Daemon #include <boost/test/unit_test.hpp> -#include <boost/filesystem/operations.hpp> +#include <filesystem> #include <testOptionsSource.h> #include <unittest.h> #include <unittestComplex.h> @@ -12,8 +12,8 @@ #define XSTR(s) STR(s) #define STR(s) #s -const auto bindir = boost::filesystem::canonical("/proc/self/exe").parent_path(); -const boost::filesystem::path iceroot(XSTR(ROOT)); +const auto bindir = std::filesystem::canonical("/proc/self/exe").parent_path(); +const std::filesystem::path iceroot(XSTR(ROOT)); const auto headers = iceroot.parent_path().parent_path(); class DummyTask : public Task { @@ -202,9 +202,9 @@ BOOST_FIXTURE_TEST_SUITE( Core, TestAppInstance ); BOOST_AUTO_TEST_CASE( test_daemon ) { - const boost::filesystem::path tmpdir = "/tmp/ut/project2.slice-daemon"; + const std::filesystem::path tmpdir = "/tmp/ut/project2.slice-daemon"; BOOST_TEST_CHECKPOINT("Clean up"); - boost::filesystem::remove_all(tmpdir); + std::filesystem::remove_all(tmpdir); BOOST_TEST_CHECKPOINT("Configure, compile, link, load"); TestOptionsSource::LoadTestOptions({ }); @@ -219,17 +219,17 @@ BOOST_AUTO_TEST_CASE( test_daemon ) { "ice.daemon.slicerdaemon", (iceroot / "unittestTypes.ice").string() }, { "ice.daemon.slicerdaemon", (iceroot / "unittest.ice").string() } }); - BOOST_REQUIRE(!boost::filesystem::exists(tmpdir / "unittest.so")); - BOOST_REQUIRE(boost::filesystem::exists(tmpdir / "unittest.daemon.so")); - BOOST_REQUIRE(!boost::filesystem::exists(tmpdir / "unittestTypes.so")); - BOOST_REQUIRE(!boost::filesystem::exists(tmpdir / "unittestTypes.daemon.so")); - BOOST_REQUIRE(!boost::filesystem::exists(tmpdir / "unittestComplex.so")); - BOOST_REQUIRE(boost::filesystem::exists(tmpdir / "unittestComplex.daemon.so")); + BOOST_REQUIRE(!std::filesystem::exists(tmpdir / "unittest.so")); + BOOST_REQUIRE(std::filesystem::exists(tmpdir / "unittest.daemon.so")); + BOOST_REQUIRE(!std::filesystem::exists(tmpdir / "unittestTypes.so")); + BOOST_REQUIRE(!std::filesystem::exists(tmpdir / "unittestTypes.daemon.so")); + BOOST_REQUIRE(!std::filesystem::exists(tmpdir / "unittestComplex.so")); + BOOST_REQUIRE(std::filesystem::exists(tmpdir / "unittestComplex.daemon.so")); commonTests(); TestOptionsSource::LoadTestOptions({ }); unloadTests(); - boost::filesystem::remove_all(tmpdir); + std::filesystem::remove_all(tmpdir); } BOOST_AUTO_TEST_SUITE_END(); diff --git a/project2/ice/unittests/testDaemonCompile.cpp b/project2/ice/unittests/testDaemonCompile.cpp index 08dd3db..6125e6c 100644 --- a/project2/ice/unittests/testDaemonCompile.cpp +++ b/project2/ice/unittests/testDaemonCompile.cpp @@ -1,6 +1,6 @@ #define BOOST_TEST_MODULE DaemonCompile #include <boost/test/unit_test.hpp> -#include <boost/filesystem/operations.hpp> +#include <filesystem> #include <testOptionsSource.h> #include <exceptions.h> #include <iceDaemon.h> @@ -8,8 +8,8 @@ #define XSTR(s) STR(s) #define STR(s) #s -const auto bindir = boost::filesystem::canonical("/proc/self/exe").parent_path(); -const boost::filesystem::path iceroot(XSTR(ROOT)); +const auto bindir = std::filesystem::canonical("/proc/self/exe").parent_path(); +const std::filesystem::path iceroot(XSTR(ROOT)); const auto headers = iceroot.parent_path().parent_path(); static @@ -32,9 +32,9 @@ BOOST_FIXTURE_TEST_SUITE( Core, TestAppInstance ); BOOST_AUTO_TEST_CASE( compile_daemon_full ) { - const boost::filesystem::path tmpdir = "/tmp/ut/project2.slice-daemonCompile/full"; + const std::filesystem::path tmpdir = "/tmp/ut/project2.slice-daemonCompile/full"; BOOST_TEST_CHECKPOINT("Clean up"); - boost::filesystem::remove_all(tmpdir); + std::filesystem::remove_all(tmpdir); BOOST_TEST_CHECKPOINT("Configure, compile, link, load"); TestOptionsSource::LoadTestOptions({ @@ -43,22 +43,22 @@ BOOST_AUTO_TEST_CASE( compile_daemon_full ) { "ice.daemon.slice", (iceroot / "unittestTypes.ice").string() }, { "ice.daemon.slice", (iceroot / "unittest.ice").string() } }); - BOOST_REQUIRE(boost::filesystem::exists(tmpdir / "unittest.so")); - BOOST_REQUIRE(boost::filesystem::exists(tmpdir / "unittest.daemon.so")); - BOOST_REQUIRE(boost::filesystem::exists(tmpdir / "unittestTypes.so")); - BOOST_REQUIRE(!boost::filesystem::exists(tmpdir / "unittestTypes.daemon.so")); + BOOST_REQUIRE(std::filesystem::exists(tmpdir / "unittest.so")); + BOOST_REQUIRE(std::filesystem::exists(tmpdir / "unittest.daemon.so")); + BOOST_REQUIRE(std::filesystem::exists(tmpdir / "unittestTypes.so")); + BOOST_REQUIRE(!std::filesystem::exists(tmpdir / "unittestTypes.daemon.so")); commonTests(); TestOptionsSource::LoadTestOptions({ }); unloadTests(); - boost::filesystem::remove_all(tmpdir); + std::filesystem::remove_all(tmpdir); } BOOST_AUTO_TEST_CASE( compile_daemon_daemonOnly ) { - const boost::filesystem::path tmpdir = "/tmp/ut/project2.slice-daemonCompile/daemonOnly"; + const std::filesystem::path tmpdir = "/tmp/ut/project2.slice-daemonCompile/daemonOnly"; BOOST_TEST_CHECKPOINT("Clean up"); - boost::filesystem::remove_all(tmpdir); + std::filesystem::remove_all(tmpdir); BOOST_TEST_CHECKPOINT("Configure, compile, link, load"); TestOptionsSource::LoadTestOptions({ @@ -68,22 +68,22 @@ BOOST_AUTO_TEST_CASE( compile_daemon_daemonOnly ) { "ice.daemon.slicedaemon", (iceroot / "unittestTypes.ice").string() }, { "ice.daemon.slicedaemon", (iceroot / "unittest.ice").string() } }); - BOOST_REQUIRE(!boost::filesystem::exists(tmpdir / "unittest.so")); - BOOST_REQUIRE(boost::filesystem::exists(tmpdir / "unittest.daemon.so")); - BOOST_REQUIRE(boost::filesystem::exists(tmpdir / "unittestTypes.so")); - BOOST_REQUIRE(!boost::filesystem::exists(tmpdir / "unittestTypes.daemon.so")); + BOOST_REQUIRE(!std::filesystem::exists(tmpdir / "unittest.so")); + BOOST_REQUIRE(std::filesystem::exists(tmpdir / "unittest.daemon.so")); + BOOST_REQUIRE(std::filesystem::exists(tmpdir / "unittestTypes.so")); + BOOST_REQUIRE(!std::filesystem::exists(tmpdir / "unittestTypes.daemon.so")); commonTests(); TestOptionsSource::LoadTestOptions({ }); unloadTests(); - boost::filesystem::remove_all(tmpdir); + std::filesystem::remove_all(tmpdir); } BOOST_AUTO_TEST_CASE( compile_daemon_slicer ) { - const boost::filesystem::path tmpdir = "/tmp/ut/project2.slice-daemonCompile/slicer"; + const std::filesystem::path tmpdir = "/tmp/ut/project2.slice-daemonCompile/slicer"; BOOST_TEST_CHECKPOINT("Clean up"); - boost::filesystem::remove_all(tmpdir); + std::filesystem::remove_all(tmpdir); BOOST_TEST_CHECKPOINT("Configure, compile, link, load"); TestOptionsSource::LoadTestOptions({ @@ -93,15 +93,15 @@ BOOST_AUTO_TEST_CASE( compile_daemon_slicer ) { "ice.daemon.slicerdaemon", (iceroot / "unittestTypes.ice").string() }, { "ice.daemon.slicerdaemon", (iceroot / "unittest.ice").string() } }); - BOOST_REQUIRE(!boost::filesystem::exists(tmpdir / "unittest.so")); - BOOST_REQUIRE(boost::filesystem::exists(tmpdir / "unittest.daemon.so")); - BOOST_REQUIRE(!boost::filesystem::exists(tmpdir / "unittestTypes.so")); - BOOST_REQUIRE(!boost::filesystem::exists(tmpdir / "unittestTypes.daemon.so")); + BOOST_REQUIRE(!std::filesystem::exists(tmpdir / "unittest.so")); + BOOST_REQUIRE(std::filesystem::exists(tmpdir / "unittest.daemon.so")); + BOOST_REQUIRE(!std::filesystem::exists(tmpdir / "unittestTypes.so")); + BOOST_REQUIRE(!std::filesystem::exists(tmpdir / "unittestTypes.daemon.so")); commonTests(); TestOptionsSource::LoadTestOptions({ }); unloadTests(); - boost::filesystem::remove_all(tmpdir); + std::filesystem::remove_all(tmpdir); } BOOST_AUTO_TEST_SUITE_END(); diff --git a/project2/json/Jamfile.jam b/project2/json/Jamfile.jam index 40cdcba..3a47ff2 100644 --- a/project2/json/Jamfile.jam +++ b/project2/json/Jamfile.jam @@ -2,7 +2,7 @@ alias glibmm : : : : <cflags>"`pkg-config --cflags glibmm-2.4`" <linkflags>"`pkg-config --libs glibmm-2.4`" ; -lib boost_filesystem : : <name>boost_filesystem ; +lib stdc++fs ; lib boost_date_time : : <name>boost_date_time ; lib jsonpp ; @@ -19,7 +19,7 @@ lib p2json : <library>../common//p2common <library>..//adhocutil <library>../url//p2url - <library>boost_filesystem + <library>stdc++fs <library>boost_date_time : : <include>. diff --git a/project2/sql/Jamfile.jam b/project2/sql/Jamfile.jam index 2affda0..dfe578f 100644 --- a/project2/sql/Jamfile.jam +++ b/project2/sql/Jamfile.jam @@ -2,7 +2,7 @@ alias glibmm : : : : <cflags>"`pkg-config --cflags glibmm-2.4`" <linkflags>"`pkg-config --libs glibmm-2.4`" ; -lib boost_filesystem ; +lib stdc++fs ; lib dbppcore : : : : <include>/usr/include/dbpp ; build-project unittests ; @@ -20,7 +20,7 @@ lib p2sql : <include>. <library>dbppcore <library>glibmm - <library>boost_filesystem + <library>stdc++fs <library>../common//p2common <library>../basics//p2basics <library>..//adhocutil diff --git a/project2/ut/Jamfile.jam b/project2/ut/Jamfile.jam index 335294f..982f9ea 100644 --- a/project2/ut/Jamfile.jam +++ b/project2/ut/Jamfile.jam @@ -1,5 +1,5 @@ lib boost_utf : : <name>boost_unit_test_framework ; -lib boost_fs : : <name>boost_filesystem ; +lib boost_fs : : <name>stdc++fs ; lib p2ut : [ glob *.cpp ] diff --git a/project2/ut/testPresenter.cpp b/project2/ut/testPresenter.cpp index f31309c..eb9ed59 100644 --- a/project2/ut/testPresenter.cpp +++ b/project2/ut/testPresenter.cpp @@ -1,6 +1,6 @@ #include "testPresenter.h" #include <buffer.h> -#include <boost/filesystem/operations.hpp> +#include <filesystem> #include <boost/test/test_tools.hpp> #include <fstream> #include <boost/format.hpp> @@ -115,10 +115,10 @@ namespace std { } bool - operator==(const PresenterData & left, const boost::filesystem::path & rightPath) + operator==(const PresenterData & left, const std::filesystem::path & rightPath) { PresenterData right; - BOOST_REQUIRE(boost::filesystem::exists(rightPath)); + BOOST_REQUIRE(std::filesystem::exists(rightPath)); fstream strm(rightPath.string()); strm >> right; return (left == right); diff --git a/project2/ut/testPresenter.h b/project2/ut/testPresenter.h index ac36bfa..027b7d0 100644 --- a/project2/ut/testPresenter.h +++ b/project2/ut/testPresenter.h @@ -3,7 +3,7 @@ #include <string> #include <vector> -#include <boost/filesystem/path.hpp> +#include <filesystem> #include <presenter.h> #include <visibility.h> @@ -33,7 +33,7 @@ class DLL_PUBLIC TestPresenter : public Presenter { }; namespace std { - DLL_PUBLIC bool operator==(const PresenterData &, const boost::filesystem::path &); + DLL_PUBLIC bool operator==(const PresenterData &, const std::filesystem::path &); DLL_PUBLIC std::ostream & operator<<(std::ostream & s, const PresenterData & v); DLL_PUBLIC std::istream & operator>>(std::istream & s, PresenterData & v); } diff --git a/project2/xml/Jamfile.jam b/project2/xml/Jamfile.jam index a416db9..021f6df 100644 --- a/project2/xml/Jamfile.jam +++ b/project2/xml/Jamfile.jam @@ -1,7 +1,7 @@ alias libxslt : : : : <cflags>"`pkg-config --cflags libexslt`" <linkflags>"`pkg-config --libs libexslt`" ; -lib boost_filesystem : : <name>boost_filesystem ; +lib stdc++fs ; lib boost_date_time : : <name>boost_date_time ; lib Ice : : <name>Ice++11 ; @@ -20,7 +20,7 @@ lib p2xml : <library>..//adhocutil <library>Ice <library>libxslt - <library>boost_filesystem + <library>stdc++fs <library>boost_date_time : : <include>. diff --git a/project2/xml/pch.hpp b/project2/xml/pch.hpp index 5832628..210a49c 100644 --- a/project2/xml/pch.hpp +++ b/project2/xml/pch.hpp @@ -2,7 +2,7 @@ #ifndef XML_PCH #define XML_PCH -#include <boost/filesystem/path.hpp> +#include <filesystem> #include <boost/variant/variant_fwd.hpp> #include <libxml++/document.h> #include <libxml++/nodes/element.h> diff --git a/project2/xml/sessionXml.cpp b/project2/xml/sessionXml.cpp index 682d49a..bd60bf6 100644 --- a/project2/xml/sessionXml.cpp +++ b/project2/xml/sessionXml.cpp @@ -5,7 +5,7 @@ #include <libxml++/nodes/element.h> #include <libxml++/parsers/domparser.h> #include <boost/bind.hpp> -#include <boost/filesystem/convenience.hpp> +#include <filesystem> #include <boost/lexical_cast.hpp> #include "options.h" #include "logger.h" @@ -15,14 +15,14 @@ class CustomSessionContainerFactoryXml : public SessionContainerFactory::For<Ses void onPeriodic() override { try { - if (boost::filesystem::is_directory(SessionContainerXml::xmlDir)) { - boost::filesystem::directory_iterator end; - for (boost::filesystem::directory_iterator p(SessionContainerXml::xmlDir); p != end; ++p) { + if (std::filesystem::is_directory(SessionContainerXml::xmlDir)) { + std::filesystem::directory_iterator end; + for (std::filesystem::directory_iterator p(SessionContainerXml::xmlDir); p != end; ++p) { xmlpp::DomParser session(p->path().string()); xmlpp::Element * sess = session.get_document()->get_root_node(); time_t expires = boost::lexical_cast<time_t>(sess->get_attribute_value("expires")); if (expires < time(NULL)) { - boost::filesystem::remove(*p); + std::filesystem::remove(*p); } } } @@ -37,7 +37,7 @@ DECLARE_OPTIONS(SessionContainerXml, "Session XML options") "Path of the folder in which to store XML files for session information") END_OPTIONS(SessionContainerXml) -boost::filesystem::path SessionContainerXml::xmlDir; +std::filesystem::path SessionContainerXml::xmlDir; NAMEDPLUGIN("xml", CustomSessionContainerFactoryXml, SessionContainerFactory); SessionContainerXml::SessionContainerXml() @@ -63,8 +63,8 @@ SessionContainerXml::SaveSession(SessionPtr currentSession) const xmlpp::Element * sess = d.create_root_node("session"); sess->set_attribute("expires", boost::lexical_cast<Glib::ustring>(currentSession->ExpiryTime())); currentSession->ForeachValue(boost::bind(appendToXmlNode, sess, _1, _2)); - boost::filesystem::create_directories(SessionContainerXml::xmlDir); - boost::filesystem::path p = xmlDir / boost::lexical_cast<std::string>(currentSession->ID()); + std::filesystem::create_directories(SessionContainerXml::xmlDir); + std::filesystem::path p = xmlDir / boost::lexical_cast<std::string>(currentSession->ID()); d.write_to_file(p.string()); } @@ -72,12 +72,12 @@ SessionPtr SessionContainerXml::getSession(const boost::uuids::uuid & sid) const { try { - boost::filesystem::path p = xmlDir / boost::lexical_cast<std::string>(sid); + std::filesystem::path p = xmlDir / boost::lexical_cast<std::string>(sid); xmlpp::DomParser session(p.string()); xmlpp::Element * sess = session.get_document()->get_root_node(); time_t expires = boost::lexical_cast<time_t>(sess->get_attribute_value("expires")); if (expires < time(NULL)) { - boost::filesystem::remove(p); + std::filesystem::remove(p); return NULL; } SessionPtr s = std::make_shared<Session>(sid); diff --git a/project2/xml/sessionXml.h b/project2/xml/sessionXml.h index dd194fe..4a03e37 100644 --- a/project2/xml/sessionXml.h +++ b/project2/xml/sessionXml.h @@ -3,7 +3,7 @@ #include "sessionContainer.h" #include "options.h" -#include <boost/filesystem/path.hpp> +#include <filesystem> class DLL_PUBLIC SessionContainerXml : public SessionContainer { public: @@ -17,7 +17,7 @@ class DLL_PUBLIC SessionContainerXml : public SessionContainer { private: // Configurables - static boost::filesystem::path xmlDir; + static std::filesystem::path xmlDir; friend class CustomSessionContainerFactoryXml; }; diff --git a/project2/xml/unittests/Jamfile.jam b/project2/xml/unittests/Jamfile.jam index f520c04..b2e0652 100644 --- a/project2/xml/unittests/Jamfile.jam +++ b/project2/xml/unittests/Jamfile.jam @@ -1,7 +1,6 @@ import testing ; -lib boost_system ; -lib boost_filesystem ; +lib stdc++fs ; path-constant me : . ; @@ -13,6 +12,6 @@ run <define>ROOT=\"$(me)\" <library>..//p2xml <library>../../ut//p2ut - <library>boost_filesystem + <library>stdc++fs : testxml ; diff --git a/project2/xml/unittests/testxml.cpp b/project2/xml/unittests/testxml.cpp index 4cedcb8..fe2911d 100644 --- a/project2/xml/unittests/testxml.cpp +++ b/project2/xml/unittests/testxml.cpp @@ -16,12 +16,12 @@ systembf(const char * fmt, const T & ... params) return system(stringbf(fmt, params...).c_str()); } -const boost::filesystem::path tmpdir = "/tmp/ut/project2.xml"; +const std::filesystem::path tmpdir = "/tmp/ut/project2.xml"; BOOST_AUTO_TEST_CASE( before ) { - boost::filesystem::remove_all(tmpdir); - boost::filesystem::create_directories(tmpdir); + std::filesystem::remove_all(tmpdir); + std::filesystem::create_directories(tmpdir); } BOOST_AUTO_TEST_CASE( rawview ) @@ -39,11 +39,11 @@ BOOST_AUTO_TEST_CASE( rawview ) BOOST_REQUIRE_EQUAL(0, systembf("diff -w --unified %s %s", out, rootDir / "expected" / "rawview.xml")); - boost::filesystem::remove_all(tmpdir); + std::filesystem::remove_all(tmpdir); } BOOST_AUTO_TEST_CASE( after ) { - boost::filesystem::remove_all(tmpdir); + std::filesystem::remove_all(tmpdir); } diff --git a/project2/xml/xmlCache.cpp b/project2/xml/xmlCache.cpp index 95607d7..b33824a 100644 --- a/project2/xml/xmlCache.cpp +++ b/project2/xml/xmlCache.cpp @@ -7,8 +7,7 @@ #include "xmlPresenter.h" #include <sys/stat.h> #include "options.h" -#include <boost/filesystem/path.hpp> -#include <boost/filesystem/convenience.hpp> +#include <filesystem> #include <libxml++/document.h> class XmlCache : public RowSetCache { @@ -21,11 +20,11 @@ class XmlCache : public RowSetCache { RowSetCPtr getCachedRowSet(ExecContext * ec, const Glib::ustring & n, const Glib::ustring & f, const IHaveParameters * ps) const { - boost::filesystem::path cache = getCacheFile(ec, n, f, ps); + std::filesystem::path cache = getCacheFile(ec, n, f, ps); struct stat st; if (stat(cache.string().c_str(), &st) == 0) { if (st.st_mtime < time(NULL) - CacheLife) { - boost::filesystem::remove(cache); + std::filesystem::remove(cache); return NULL; } return std::make_shared<XmlRawRows>(cache.string()); @@ -41,9 +40,9 @@ class XmlCache : public RowSetCache { void save(ExecContext * ec, const Glib::ustring & n, const Glib::ustring & f, const IHaveParameters * ps) { - boost::filesystem::path target = getCacheFile(ec, n, f, ps); + std::filesystem::path target = getCacheFile(ec, n, f, ps); try { - boost::filesystem::create_directories(target.parent_path()); + std::filesystem::create_directories(target.parent_path()); const xmlpp::Document * d = *writeTo; const_cast<xmlpp::Document *>(d)->write_to_file(target.string()); writeTo.reset(); @@ -59,15 +58,15 @@ class XmlCache : public RowSetCache { INITOPTIONS; private: - boost::filesystem::path getCacheFile(ExecContext * ec, const Glib::ustring & n, const Glib::ustring & f, const IHaveParameters * ps) const + std::filesystem::path getCacheFile(ExecContext * ec, const Glib::ustring & n, const Glib::ustring & f, const IHaveParameters * ps) const { - boost::filesystem::path cache = Store / n.raw() / f.raw(); + std::filesystem::path cache = Store / n.raw() / f.raw(); applyKeys(ec, boost::bind(&appendPath, &cache, _1, _2), ps); cache /= FileName; return cache; } - static void appendPath(boost::filesystem::path * cache, const std::string & n, const VariableType & v) + static void appendPath(std::filesystem::path * cache, const std::string & n, const VariableType & v) { *cache /= n; *cache /= v.operator const std::string &(); @@ -76,12 +75,12 @@ class XmlCache : public RowSetCache { XmlPresenterPtr writeTo; friend class CustomXmlCacheFactory; - static boost::filesystem::path Store; + static std::filesystem::path Store; static std::string FileName; static time_t CacheLife; }; -boost::filesystem::path XmlCache::Store; +std::filesystem::path XmlCache::Store; std::string XmlCache::FileName; time_t XmlCache::CacheLife; @@ -90,7 +89,7 @@ class CustomXmlCacheFactory : public AdHoc::Factory<RowSetCache, std::shared_ptr void onIdle() override { try { - if (boost::filesystem::is_directory(XmlCache::Store)) { + if (std::filesystem::is_directory(XmlCache::Store)) { emptyDir(XmlCache::Store); } } @@ -99,11 +98,11 @@ class CustomXmlCacheFactory : public AdHoc::Factory<RowSetCache, std::shared_ptr } } - bool emptyDir(const boost::filesystem::path & dir) + bool emptyDir(const std::filesystem::path & dir) { bool files = false; - boost::filesystem::directory_iterator end; - for (boost::filesystem::directory_iterator itr(dir); itr != end; ++itr) { + std::filesystem::directory_iterator end; + for (std::filesystem::directory_iterator itr(dir); itr != end; ++itr) { struct stat st; stat(itr->path().string().c_str(), &st); if (S_ISDIR(st.st_mode)) { @@ -111,7 +110,7 @@ class CustomXmlCacheFactory : public AdHoc::Factory<RowSetCache, std::shared_ptr files = true; } else { - boost::filesystem::remove(*itr); + std::filesystem::remove(*itr); } } else { @@ -119,7 +118,7 @@ class CustomXmlCacheFactory : public AdHoc::Factory<RowSetCache, std::shared_ptr files = true; } else { - boost::filesystem::remove(*itr); + std::filesystem::remove(*itr); } } } diff --git a/project2/xml/xmlScriptParser.cpp b/project2/xml/xmlScriptParser.cpp index c20445b..7e4565b 100644 --- a/project2/xml/xmlScriptParser.cpp +++ b/project2/xml/xmlScriptParser.cpp @@ -3,29 +3,30 @@ #include "scripts.h" #include "commonObjects.h" #include "variables/literal.h" -#include <boost/filesystem/convenience.hpp> +#include <filesystem> static const std::string XIncludeNS("http://www.w3.org/2001/XInclude"); static const std::string XIncludeInclude("include"); -XmlScriptParser::XmlScriptParser(const boost::filesystem::path & file) +XmlScriptParser::XmlScriptParser(const std::filesystem::path & file) { try { - parse_file(file.string()); + parse_file(file); } catch (const xmlpp::internal_error &) { throw NotReadable(file.string()); } doIncludes(get_document()->get_root_node(), file); - files.insert(Files::value_type(file, boost::filesystem::last_write_time(file))); + files.insert(Files::value_type(file, std::chrono::system_clock::to_time_t( + std::filesystem::last_write_time(file)))); } void -XmlScriptParser::doIncludes(xmlpp::Element * e, const boost::filesystem::path & f) +XmlScriptParser::doIncludes(xmlpp::Element * e, const std::filesystem::path & f) { if (e->get_namespace_uri().raw() == XIncludeNS && e->get_name().raw() == XIncludeInclude) { - boost::filesystem::path inc = f.parent_path(); - for (boost::filesystem::path c : boost::filesystem::path(e->get_attribute_value("href").raw())) { + std::filesystem::path inc = f.parent_path(); + for (std::filesystem::path c : std::filesystem::path(e->get_attribute_value("href").raw())) { if (c.string() == "..") { inc = inc.parent_path(); } @@ -37,7 +38,8 @@ XmlScriptParser::doIncludes(xmlpp::Element * e, const boost::filesystem::path & xmlpp::DomParser(inc.string()).get_document()->get_root_node()))) { doIncludes(c, inc); } - files.insert(Files::value_type(inc, boost::filesystem::last_write_time(inc))); + files.insert(Files::value_type(inc, std::chrono::system_clock::to_time_t( + std::filesystem::last_write_time(inc)))); } else { for (xmlpp::Node * n : e->get_children()) { @@ -77,12 +79,12 @@ XmlScriptParser::isCurrent() const { for (const Files::value_type & f : files) { try { - if (boost::filesystem::last_write_time(f.first) != f.second) { + if (std::chrono::system_clock::to_time_t(std::filesystem::last_write_time(f.first)) != f.second) { _root.reset(); return false; } } - catch (const boost::filesystem::filesystem_error &) { + catch (const std::filesystem::filesystem_error &) { _root.reset(); return false; } @@ -93,8 +95,8 @@ XmlScriptParser::isCurrent() const class XmlScriptReaderFactory : public ScriptReaderFactory { public: std::shared_ptr<ScriptReader> create(const std::string & group, const std::string & name) const { - boost::filesystem::path script(boost::filesystem::path(group) / (name + ".xml")); - if (boost::filesystem::is_regular_file(script)) { + std::filesystem::path script(std::filesystem::path(group) / (name + ".xml")); + if (std::filesystem::is_regular_file(script)) { return std::make_shared<XmlScriptParser>(script); } return NULL; diff --git a/project2/xml/xmlScriptParser.h b/project2/xml/xmlScriptParser.h index 4f9881b..e53e165 100644 --- a/project2/xml/xmlScriptParser.h +++ b/project2/xml/xmlScriptParser.h @@ -5,7 +5,7 @@ #include "exceptions.h" #include "scriptLoader.h" #include "scripts.h" -#include <boost/filesystem/path.hpp> +#include <filesystem> #include <libxml++/document.h> #include <libxml++/nodes/element.h> #include <libxml++/parsers/domparser.h> @@ -38,15 +38,15 @@ class DLL_PUBLIC XmlScriptParser : public xmlpp::DomParser, public ScriptReader, SimpleMessageExceptionBase(NotReadable, ParseError); SimpleMessageExceptionBase(IncludesError, ParseError); - XmlScriptParser(const boost::filesystem::path & file); + XmlScriptParser(const std::filesystem::path & file); ScriptNodePtr root() const; void load(const CommonObjects *, bool childrenOnly) const; bool isCurrent() const; time_t modifiedTime() const; private: mutable ScriptNodePtr _root; - void doIncludes(xmlpp::Element * e, const boost::filesystem::path & f); - typedef std::map<boost::filesystem::path, std::time_t> Files; + void doIncludes(xmlpp::Element * e, const std::filesystem::path & f); + typedef std::map<std::filesystem::path, std::time_t> Files; Files files; }; diff --git a/project2/xml/xpathRows.cpp b/project2/xml/xpathRows.cpp index c00519d..5815ce1 100644 --- a/project2/xml/xpathRows.cpp +++ b/project2/xml/xpathRows.cpp @@ -107,6 +107,7 @@ XPathRows::execute(const Glib::ustring & filter, const RowProcessorCallback & rp } xs.process(ec, rp); } + std::cerr << __PRETTY_FUNCTION__ << std::endl; } XPathRows::FilterView::FilterView(ScriptNodePtr p) : |