diff --git a/ACore/CMakeLists.txt b/ACore/CMakeLists.txt index 176bea426..ab5de68cf 100644 --- a/ACore/CMakeLists.txt +++ b/ACore/CMakeLists.txt @@ -34,6 +34,7 @@ set(srcs src/ecflow/core/Extract.hpp src/ecflow/core/File.hpp src/ecflow/core/File_r.hpp + src/ecflow/core/Filesystem.hpp src/ecflow/core/Host.hpp src/ecflow/core/Indentor.hpp src/ecflow/core/Log.hpp @@ -74,6 +75,7 @@ set(srcs src/ecflow/core/Extract.cpp src/ecflow/core/File.cpp src/ecflow/core/File_r.cpp + src/ecflow/core/Filesystem.cpp src/ecflow/core/Host.cpp src/ecflow/core/Indentor.cpp src/ecflow/core/Log.cpp diff --git a/ACore/src/ecflow/core/EcfPortLock.hpp b/ACore/src/ecflow/core/EcfPortLock.hpp index 07175bb05..e7e7c7d47 100644 --- a/ACore/src/ecflow/core/EcfPortLock.hpp +++ b/ACore/src/ecflow/core/EcfPortLock.hpp @@ -21,9 +21,6 @@ #include #include -#include -#include - #include "ecflow/core/Converter.hpp" #include "ecflow/core/File.hpp" @@ -33,7 +30,7 @@ class EcfPortLock { public: static bool is_free(int port, bool debug = false) { std::string the_port = ecf::convert_to(port); - if (boost::filesystem::exists(port_file(the_port))) { + if (fs::exists(port_file(the_port))) { if (debug) std::cout << " EcfPortLock::is_free(" << port << ") returning FALSE\n "; return false; @@ -59,7 +56,7 @@ class EcfPortLock { std::string the_file = port_file(the_port); // std::cout << "EcfPortLock::remove " << the_file << " // --------------------------------------------------\n"; - boost::filesystem::remove(the_file); + fs::remove(the_file); } private: diff --git a/ACore/src/ecflow/core/File.cpp b/ACore/src/ecflow/core/File.cpp index 66023b1f5..e118dd9aa 100644 --- a/ACore/src/ecflow/core/File.cpp +++ b/ACore/src/ecflow/core/File.cpp @@ -26,7 +26,6 @@ using namespace std; using namespace boost; -namespace fs = boost::filesystem; // #define DEBUG_SERVER_PATH 1 // #define DEBUG_CLIENT_PATH 1 @@ -348,9 +347,9 @@ std::string File::stream_error_condition(const std::ios& stream) { return msg; } -bool File::find(const boost::filesystem::path& dir_path, // from this directory downwards, - const std::string& file_name, // search for this name, - boost::filesystem::path& path_found // placing path here if found +bool File::find(const fs::path& dir_path, // from this directory downwards, + const std::string& file_name, // search for this name, + fs::path& path_found // placing path here if found ) { // std::cout << "Searching '" << dir_path << "' for " << file_name << "\n"; if (!fs::exists(dir_path)) @@ -373,9 +372,9 @@ bool File::find(const boost::filesystem::path& dir_path, // from this directory return false; } -void File::findAll(const boost::filesystem::path& dir_path, // from this directory downwards - const std::string& file_name, // search for this name, - std::vector& paths_found // placing path here if found +void File::findAll(const fs::path& dir_path, // from this directory downwards + const std::string& file_name, // search for this name, + std::vector& paths_found // placing path here if found ) { if (!fs::exists(dir_path)) return; @@ -394,9 +393,9 @@ void File::findAll(const boost::filesystem::path& dir_path, // from thi } } -void File::find_files_with_extn(const boost::filesystem::path& dir_path, // In this directory - const std::string& extn, // find files matching this extension - std::vector& paths_found // placing path here if found +void File::find_files_with_extn(const fs::path& dir_path, // In this directory + const std::string& extn, // find files matching this extension + std::vector& paths_found // placing path here if found ) { if (!fs::exists(dir_path)) { return; @@ -412,9 +411,9 @@ void File::find_files_with_extn(const boost::filesystem::path& dir_path, } } -std::string File::findPath(const boost::filesystem::path& dir_path, // from this directory downwards - const std::string& file_name, // search for this name, - const std::string& leafDir // path must contain this string +std::string File::findPath(const fs::path& dir_path, // from this directory downwards + const std::string& file_name, // search for this name, + const std::string& leafDir // path must contain this string ) { std::vector paths; File::findAll(dir_path, file_name, paths); @@ -430,9 +429,9 @@ std::string File::findPath(const boost::filesystem::path& dir_path, // from this return std::string(); } -std::string File::findPath(const boost::filesystem::path& dir_path, // from this directory downwards - const std::string& file_name, // search for this name, - const std::vector& tokens // path must contain all these tokens +std::string File::findPath(const fs::path& dir_path, // from this directory downwards + const std::string& file_name, // search for this name, + const std::vector& tokens // path must contain all these tokens ) { std::vector paths; File::findAll(dir_path, file_name, paths); @@ -801,7 +800,7 @@ std::string File::forwardSearch(const std::string& rootPath, const std::string& } // Remove a directory recursively **** -bool File::removeDir(const boost::filesystem::path& p) { +bool File::removeDir(const fs::path& p) { try { fs::directory_iterator end; for (fs::directory_iterator it(p); it != end; ++it) { @@ -832,9 +831,9 @@ bool File::removeDir(const boost::filesystem::path& p) { static std::string bjam_workspace_dir() { // We need the *SAME* location so that different process find the same file. Get to the workspace directory - boost::filesystem::path current_path = boost::filesystem::current_path(); - std::string stem = current_path.stem().string(); - int count = 0; + auto current_path = fs::current_path(); + std::string stem = current_path.stem().string(); + int count = 0; while (stem.find("ecflow") == std::string::npos) { current_path = current_path.parent_path(); stem = current_path.stem().string(); diff --git a/ACore/src/ecflow/core/File.hpp b/ACore/src/ecflow/core/File.hpp index 9a0cc649f..f2c80d704 100644 --- a/ACore/src/ecflow/core/File.hpp +++ b/ACore/src/ecflow/core/File.hpp @@ -19,13 +19,17 @@ #include #include -#include -#include +#include "ecflow/core/Filesystem.hpp" namespace ecf { -class File : private boost::noncopyable { +class File { public: + File() = default; + File(const File&) = delete; + + File& operator=(const File&) = delete; + static size_t MAX_LINES(); // max number of lines, default to 10000 static const std::string& JOB_EXTN(); // ".job" static const std::string& MAN_EXTN(); // ".man" @@ -74,34 +78,34 @@ class File : private boost::noncopyable { /// recursively look for a file, given a starting directory /// Return the first file that matches /// return true if file found false otherwise - static bool find(const boost::filesystem::path& dir_path, // from this directory downwards - const std::string& file_name, // search for this name, - boost::filesystem::path& path_found // placing path here if found + static bool find(const fs::path& dir_path, // from this directory downwards + const std::string& file_name, // search for this name, + fs::path& path_found // placing path here if found ); /// recursively look for a file, given a starting directory /// Returns _ALL_ files that match - static void findAll(const boost::filesystem::path& dir_path, // from this directory downwards - const std::string& file_name, // search for this name, - std::vector& paths_found // placing path here if found + static void findAll(const fs::path& dir_path, // from this directory downwards + const std::string& file_name, // search for this name, + std::vector& paths_found // placing path here if found ); /// Find all files with given extension must include leading . - static void find_files_with_extn(const boost::filesystem::path& dir_path, // In this directory - const std::string& extn, // find files matching this extension - std::vector& paths_found // placing path here if found + static void find_files_with_extn(const fs::path& dir_path, // In this directory + const std::string& extn, // find files matching this extension + std::vector& paths_found // placing path here if found ); /// recursively look for a file, given a starting directory and path token /// Returns the first match found - static std::string findPath(const boost::filesystem::path& dir_path, // from this directory downwards - const std::string& file_name, // search for this name, - const std::string& leafDir // path must contain this string + static std::string findPath(const fs::path& dir_path, // from this directory downwards + const std::string& file_name, // search for this name, + const std::string& leafDir // path must contain this string ); - static std::string findPath(const boost::filesystem::path& dir_path, // from this directory downwards - const std::string& file_name, // search for this name, - const std::vector& tokens // path must contain all these tokens + static std::string findPath(const fs::path& dir_path, // from this directory downwards + const std::string& file_name, // search for this name, + const std::vector& tokens // path must contain all these tokens ); /// Create missing directories. This is *NOT* the same as boost::create_directories @@ -148,7 +152,7 @@ class File : private boost::noncopyable { forwardSearch(const std::string& rootPath, const std::string& nodePath, const std::string& fileExtn); // Remove a directory recursively **** - static bool removeDir(const boost::filesystem::path& p); + static bool removeDir(const fs::path& p); // Locate the path to the server exe static std::string find_ecf_server_path(); diff --git a/ACore/src/ecflow/core/Filesystem.cpp b/ACore/src/ecflow/core/Filesystem.cpp new file mode 100644 index 000000000..2edd9edb9 --- /dev/null +++ b/ACore/src/ecflow/core/Filesystem.cpp @@ -0,0 +1,11 @@ +/* + * Copyright 2023- ECMWF. + * + * This software is licensed under the terms of the Apache Licence version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * In applying this licence, ECMWF does not waive the privileges and immunities + * granted to it by virtue of its status as an intergovernmental organisation + * nor does it submit to any jurisdiction. + */ + +#include "Filesystem.hpp" diff --git a/ACore/src/ecflow/core/Filesystem.hpp b/ACore/src/ecflow/core/Filesystem.hpp new file mode 100644 index 000000000..f215d31b1 --- /dev/null +++ b/ACore/src/ecflow/core/Filesystem.hpp @@ -0,0 +1,20 @@ +/* + * Copyright 2023- ECMWF. + * + * This software is licensed under the terms of the Apache Licence version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * In applying this licence, ECMWF does not waive the privileges and immunities + * granted to it by virtue of its status as an intergovernmental organisation + * nor does it submit to any jurisdiction. + */ + +#ifndef ECFLOW_CORE_FILESYSTEM_HPP +#define ECFLOW_CORE_FILESYSTEM_HPP + +#include + +#include + +namespace fs = boost::filesystem; + +#endif diff --git a/ACore/src/ecflow/core/Log.cpp b/ACore/src/ecflow/core/Log.cpp index dadbf12bb..e742b4926 100644 --- a/ACore/src/ecflow/core/Log.cpp +++ b/ACore/src/ecflow/core/Log.cpp @@ -15,16 +15,13 @@ #include #include -#include -#include - #include "ecflow/core/File.hpp" +#include "ecflow/core/Filesystem.hpp" #include "ecflow/core/Indentor.hpp" #include "ecflow/core/Str.hpp" #include "ecflow/core/TimeStamp.hpp" using namespace std; -namespace fs = boost::filesystem; namespace ecf { diff --git a/ACore/src/ecflow/core/PrintStyle.hpp b/ACore/src/ecflow/core/PrintStyle.hpp index d50e0f775..0818192f5 100644 --- a/ACore/src/ecflow/core/PrintStyle.hpp +++ b/ACore/src/ecflow/core/PrintStyle.hpp @@ -36,9 +36,13 @@ class PrintStyle { NET = 4 }; + PrintStyle() = delete; + PrintStyle(const PrintStyle&) = delete; explicit PrintStyle(Type_t t) : old_style_(getStyle()) { setStyle(t); } ~PrintStyle() { setStyle(old_style_); } // reset to old style on destruction + PrintStyle& operator=(const PrintStyle&) = delete; + /// We want to control the output, so that we can dump in old style defs format /// or choose to dump for debug. static Type_t getStyle(); @@ -52,10 +56,6 @@ class PrintStyle { static std::string to_string(); static std::string to_string(PrintStyle::Type_t); -private: - PrintStyle(const PrintStyle&) = delete; - const PrintStyle& operator=(const PrintStyle&) = delete; - private: Type_t old_style_; }; diff --git a/ACore/test/TestCereal.cpp b/ACore/test/TestCereal.cpp index 8707630d0..26f7a4832 100644 --- a/ACore/test/TestCereal.cpp +++ b/ACore/test/TestCereal.cpp @@ -10,15 +10,14 @@ #include -#include #include +#include "ecflow/core/Filesystem.hpp" #include "ecflow/core/SerializationTest.hpp" using namespace ecf; using namespace boost; using namespace std; -namespace fs = boost::filesystem; class MyClass { public: diff --git a/ACore/test/TestCerealOptionalNVP.cpp b/ACore/test/TestCerealOptionalNVP.cpp index df417ec5f..3f0f163db 100644 --- a/ACore/test/TestCerealOptionalNVP.cpp +++ b/ACore/test/TestCerealOptionalNVP.cpp @@ -10,15 +10,14 @@ #include -#include #include +#include "ecflow/core/Filesystem.hpp" #include "ecflow/core/SerializationTest.hpp" using namespace ecf; using namespace boost; using namespace std; -namespace fs = boost::filesystem; class Base { public: diff --git a/ACore/test/TestCerealWithHierarchy.cpp b/ACore/test/TestCerealWithHierarchy.cpp index 452522a7d..069ba38a8 100644 --- a/ACore/test/TestCerealWithHierarchy.cpp +++ b/ACore/test/TestCerealWithHierarchy.cpp @@ -8,15 +8,14 @@ * nor does it submit to any jurisdiction. */ -#include #include +#include "ecflow/core/Filesystem.hpp" #include "ecflow/core/Serialization.hpp" using namespace ecf; using namespace boost; using namespace std; -namespace fs = boost::filesystem; // ====================================================================================== diff --git a/ACore/test/TestFile.cpp b/ACore/test/TestFile.cpp index 38e4c5bfd..b811f4a52 100644 --- a/ACore/test/TestFile.cpp +++ b/ACore/test/TestFile.cpp @@ -13,7 +13,6 @@ #include #include -#include #include #include "ecflow/core/Converter.hpp" @@ -32,7 +31,6 @@ using namespace boost; using namespace std; using namespace ecf; -namespace fs = boost::filesystem; BOOST_AUTO_TEST_SUITE(CoreTestSuite) @@ -537,14 +535,14 @@ BOOST_AUTO_TEST_CASE(test_get_all_files_by_extension) { cout << "ACore:: ...test_get_all_files_by_extension\n"; { std::string rootPath = File::test_data("ACore/test/data/badPasswdFiles", "ACore"); - std::vector vec; + std::vector vec; File::find_files_with_extn(rootPath, ".passwd", vec); // for(auto& file: vec) std::cout << file << "\n"; BOOST_REQUIRE_MESSAGE(vec.size() == 6, "Expected 6 files in directory " << rootPath); } { std::string rootPath = File::test_data("ACore/test/data/badWhiteListFiles", "ACore"); - std::vector vec; + std::vector vec; File::find_files_with_extn(rootPath, ".lists", vec); // for(auto& file: vec) std::cout << file << "\n"; BOOST_REQUIRE_MESSAGE(vec.size() == 7, "Expected 7 files in directory " << rootPath); diff --git a/ACore/test/TestLog.cpp b/ACore/test/TestLog.cpp index cdcf68e91..e9e5b634e 100644 --- a/ACore/test/TestLog.cpp +++ b/ACore/test/TestLog.cpp @@ -12,8 +12,6 @@ #include #include -#include -#include #include #include "ecflow/core/DurationTimer.hpp" @@ -24,7 +22,6 @@ using namespace ecf; using namespace std; using namespace boost; -namespace fs = boost::filesystem; BOOST_AUTO_TEST_SUITE(CoreTestSuite) diff --git a/ACore/test/TestPasswdFile.cpp b/ACore/test/TestPasswdFile.cpp index 66768cd9a..489f3c115 100644 --- a/ACore/test/TestPasswdFile.cpp +++ b/ACore/test/TestPasswdFile.cpp @@ -10,15 +10,12 @@ #include -#include -#include #include #include "ecflow/core/File.hpp" #include "ecflow/core/PasswdFile.hpp" #include "ecflow/core/PasswordEncryption.hpp" -namespace fs = boost::filesystem; using namespace std; using namespace ecf; @@ -27,8 +24,7 @@ using namespace ecf; BOOST_AUTO_TEST_SUITE(CoreTestSuite) void test_passwd_files(const std::string& directory, bool pass) { - fs::path full_path(fs::initial_path()); - full_path = fs::system_complete(fs::path(directory)); + auto full_path = fs::absolute(directory); BOOST_CHECK(fs::exists(full_path)); BOOST_CHECK(fs::is_directory(full_path)); diff --git a/ACore/test/TestStackTrace.cpp b/ACore/test/TestStackTrace.cpp index a9adcb309..843128b90 100644 --- a/ACore/test/TestStackTrace.cpp +++ b/ACore/test/TestStackTrace.cpp @@ -9,8 +9,6 @@ */ // #include -// #include -// #include // #include // #include ////#include "StackTrace.hpp" @@ -19,7 +17,6 @@ // using namespace boost; // using namespace std; // using namespace ecf; -// namespace fs = boost::filesystem; // // BOOST_AUTO_TEST_SUITE( CoreTestSuite ) // diff --git a/ACore/test/TestVersioning.cpp b/ACore/test/TestVersioning.cpp index 6cd1349a3..52609968d 100644 --- a/ACore/test/TestVersioning.cpp +++ b/ACore/test/TestVersioning.cpp @@ -10,9 +10,9 @@ #include "TestVersioning.hpp" -#include #include +#include "ecflow/core/Filesystem.hpp" #include "ecflow/core/Serialization.hpp" using namespace std; @@ -56,7 +56,7 @@ BOOST_AUTO_TEST_CASE(test_versioning) { } // remove the generate file - boost::filesystem::remove("version0"); + fs::remove("version0"); } BOOST_AUTO_TEST_SUITE_END() diff --git a/ACore/test/TestWhiteListFile.cpp b/ACore/test/TestWhiteListFile.cpp index d5720f351..c37b691f7 100644 --- a/ACore/test/TestWhiteListFile.cpp +++ b/ACore/test/TestWhiteListFile.cpp @@ -10,14 +10,11 @@ #include -#include -#include #include #include "ecflow/core/File.hpp" #include "ecflow/core/WhiteListFile.hpp" -namespace fs = boost::filesystem; using namespace std; using namespace ecf; @@ -26,8 +23,7 @@ using namespace ecf; BOOST_AUTO_TEST_SUITE(CoreTestSuite) void test_white_list_files(const std::string& directory, bool pass) { - fs::path full_path(fs::initial_path()); - full_path = fs::system_complete(fs::path(directory)); + auto full_path = fs::absolute(directory); BOOST_CHECK(fs::exists(full_path)); BOOST_CHECK(fs::is_directory(full_path)); diff --git a/ANattr/test/TestMigration.cpp b/ANattr/test/TestMigration.cpp index 1bbd43a83..4cc8827fb 100644 --- a/ANattr/test/TestMigration.cpp +++ b/ANattr/test/TestMigration.cpp @@ -9,7 +9,6 @@ */ #include -#include #include #include "ecflow/attribute/AutoArchiveAttr.hpp" @@ -37,7 +36,6 @@ using namespace std; using namespace ecf; using namespace boost::posix_time; using namespace boost::gregorian; -namespace fs = boost::filesystem; // #define UPDATE_TESTS 1 @@ -331,12 +329,12 @@ BOOST_AUTO_TEST_CASE(test_day_migration) { } // remove the generated filea, comment out to debug. - boost::filesystem::remove("test_day_migration"); - boost::filesystem::remove("test_day_migration_def"); - boost::filesystem::remove("test_day_migration_free"); - boost::filesystem::remove("test_day_migration_expired"); - boost::filesystem::remove("test_day_migration_free_and_expired"); - boost::filesystem::remove("test_day_migration_free_expired_date"); + fs::remove("test_day_migration"); + fs::remove("test_day_migration_def"); + fs::remove("test_day_migration_free"); + fs::remove("test_day_migration_expired"); + fs::remove("test_day_migration_free_and_expired"); + fs::remove("test_day_migration_free_expired_date"); } BOOST_AUTO_TEST_SUITE_END() diff --git a/ANode/src/ecflow/node/EcfFile.cpp b/ANode/src/ecflow/node/EcfFile.cpp index 591375dc7..0e318ad73 100644 --- a/ANode/src/ecflow/node/EcfFile.cpp +++ b/ANode/src/ecflow/node/EcfFile.cpp @@ -15,7 +15,6 @@ #include #include -#include #include #include // for waitpid @@ -40,10 +39,10 @@ #include #endif -namespace fs = boost::filesystem; using namespace std; using namespace ecf; using namespace boost; + static const char* T_NOOP = "nopp"; static const char* T_COMMENT = "comment"; static const char* T_MANUAL = "manual"; @@ -1114,7 +1113,7 @@ const std::string& EcfFile::doCreateJobFile(JobsParam& jobsParam) const { throw std::runtime_error(ss.str()); } -boost::filesystem::path EcfFile::file_creation_path() const { +fs::path EcfFile::file_creation_path() const { return fs::path(script_or_job_path()); } diff --git a/ANode/src/ecflow/node/EcfFile.hpp b/ANode/src/ecflow/node/EcfFile.hpp index acdc6f475..c65b5c1fa 100644 --- a/ANode/src/ecflow/node/EcfFile.hpp +++ b/ANode/src/ecflow/node/EcfFile.hpp @@ -14,8 +14,7 @@ #include #include -#include - +#include "ecflow/core/Filesystem.hpp" #include "ecflow/node/NodeFwd.hpp" // This class is used to minimise file I/0. @@ -163,7 +162,7 @@ class EcfFile { bool do_popen(const std::string& the_cmd, EcfFile::Type, std::vector& lines, std::string& errormsg) const; - boost::filesystem::path file_creation_path() const; + fs::path file_creation_path() const; std::string script_or_job_path() const; bool extract_ecfmicro(const std::string& line, std::string& ecfmicro, std::string& error_msg) const; diff --git a/ANode/src/ecflow/node/JobCreationCtrl.cpp b/ANode/src/ecflow/node/JobCreationCtrl.cpp index 374707247..bd87bd01b 100644 --- a/ANode/src/ecflow/node/JobCreationCtrl.cpp +++ b/ANode/src/ecflow/node/JobCreationCtrl.cpp @@ -14,10 +14,6 @@ #include #include -#include - -namespace fs = boost::filesystem; - void JobCreationCtrl::generate_temp_dir() { if (!getenv("TMPDIR")) throw std::runtime_error( diff --git a/ANode/src/ecflow/node/JobCreationCtrl.hpp b/ANode/src/ecflow/node/JobCreationCtrl.hpp index 16a49c3f6..c67853759 100644 --- a/ANode/src/ecflow/node/JobCreationCtrl.hpp +++ b/ANode/src/ecflow/node/JobCreationCtrl.hpp @@ -21,12 +21,12 @@ // Collates data during the node tree traversal // Note: For testing purposes we do not always want to create jobs class JobCreationCtrl : public std::enable_shared_from_this { -private: - JobCreationCtrl(const JobCreationCtrl&) = delete; - const JobCreationCtrl& operator=(const JobCreationCtrl&) = delete; - public: - JobCreationCtrl() = default; + JobCreationCtrl() = default; + JobCreationCtrl(const JobCreationCtrl&) = delete; + ~JobCreationCtrl() = default; + + JobCreationCtrl& operator=(const JobCreationCtrl&) = delete; void set_node_path(const std::string& absNodePath) { absNodePath_ = absNodePath; } const std::string& node_path() const { return absNodePath_; } diff --git a/ANode/src/ecflow/node/Memento.hpp b/ANode/src/ecflow/node/Memento.hpp index 8f50335b7..3e60d72da 100644 --- a/ANode/src/ecflow/node/Memento.hpp +++ b/ANode/src/ecflow/node/Memento.hpp @@ -37,8 +37,6 @@ /// Hence, we need to ensure we use the minimum number of serializable types. /// -#include - #include "ecflow/attribute/GenericAttr.hpp" #include "ecflow/attribute/LateAttr.hpp" #include "ecflow/attribute/QueueAttr.hpp" @@ -54,10 +52,14 @@ // #define DEBUG_MEMENTO 1 -class Memento : private boost::noncopyable { +class Memento { public: + Memento() = default; + Memento(const Memento&) = delete; virtual ~Memento(); + Memento& operator=(const Memento&) = delete; + private: /// Applies the mementos to the client side defs. Can raise std::runtime_error virtual void do_incremental_node_sync(Node*, std::vector& aspects, bool) const {} diff --git a/ANode/src/ecflow/node/MiscAttrs.hpp b/ANode/src/ecflow/node/MiscAttrs.hpp index 04950d828..077f14263 100644 --- a/ANode/src/ecflow/node/MiscAttrs.hpp +++ b/ANode/src/ecflow/node/MiscAttrs.hpp @@ -11,21 +11,21 @@ #ifndef ecflow_node_MiscAttrs_HPP #define ecflow_node_MiscAttrs_HPP -#include - #include "ecflow/attribute/GenericAttr.hpp" #include "ecflow/attribute/QueueAttr.hpp" #include "ecflow/attribute/VerifyAttr.hpp" #include "ecflow/attribute/ZombieAttr.hpp" #include "ecflow/node/Node.hpp" -class MiscAttrs : private boost::noncopyable { +class MiscAttrs { public: - explicit MiscAttrs(Node* node) : node_(node) {} - MiscAttrs(const MiscAttrs& rhs); MiscAttrs() = default; + MiscAttrs(const MiscAttrs& rhs); + explicit MiscAttrs(Node* node) : node_(node) {} ~MiscAttrs(); + MiscAttrs& operator=(const MiscAttrs&) = delete; + // needed by node serialisation void set_node(Node* n); bool checkInvariants(std::string& errorMsg) const; diff --git a/ANode/src/ecflow/node/NodeContainer.cpp b/ANode/src/ecflow/node/NodeContainer.cpp index a42b79f99..1e6bd4e8c 100644 --- a/ANode/src/ecflow/node/NodeContainer.cpp +++ b/ANode/src/ecflow/node/NodeContainer.cpp @@ -35,7 +35,6 @@ #include "ecflow/node/Task.hpp" #include "ecflow/node/move_peer.hpp" -namespace fs = boost::filesystem; using namespace ecf; using namespace std; @@ -1326,7 +1325,7 @@ void NodeContainer::remove_archived_files() { the_archive_path.erase(the_archive_path.begin() + check_pos, the_archive_path.end()); // Find *all* archived files in ECF_HOME - std::vector archived_file_vec; + std::vector archived_file_vec; File::find_files_with_extn(ecf_home, ".check", archived_file_vec); if (archived_file_vec.empty()) return; diff --git a/ANode/src/ecflow/node/Submittable.cpp b/ANode/src/ecflow/node/Submittable.cpp index 179d9b755..7bc59018f 100644 --- a/ANode/src/ecflow/node/Submittable.cpp +++ b/ANode/src/ecflow/node/Submittable.cpp @@ -13,8 +13,6 @@ #include #include -#include - #include "ecflow/core/Converter.hpp" #include "ecflow/core/Ecf.hpp" #include "ecflow/core/Extract.hpp" @@ -30,10 +28,8 @@ #include "ecflow/node/Memento.hpp" #include "ecflow/node/System.hpp" -namespace fs = boost::filesystem; using namespace ecf; using namespace std; -using namespace boost; // #define DEBUG_TASK_LOCATION 1 diff --git a/ANode/src/ecflow/node/TaskScriptGenerator.cpp b/ANode/src/ecflow/node/TaskScriptGenerator.cpp index 466637555..099feb243 100644 --- a/ANode/src/ecflow/node/TaskScriptGenerator.cpp +++ b/ANode/src/ecflow/node/TaskScriptGenerator.cpp @@ -12,8 +12,6 @@ #include -#include - #include "ecflow/attribute/QueueAttr.hpp" #include "ecflow/core/Converter.hpp" #include "ecflow/core/Ecf.hpp" @@ -23,7 +21,6 @@ using namespace std; using namespace boost; -namespace fs = boost::filesystem; namespace ecf { diff --git a/ANode/test/TestAlias.cpp b/ANode/test/TestAlias.cpp index 175ff0b28..36aa33028 100644 --- a/ANode/test/TestAlias.cpp +++ b/ANode/test/TestAlias.cpp @@ -10,8 +10,6 @@ #include -#include -#include #include #include "ecflow/core/File.hpp" @@ -22,7 +20,6 @@ #include "ecflow/node/Suite.hpp" #include "ecflow/node/Task.hpp" -namespace fs = boost::filesystem; using namespace std; using namespace ecf; diff --git a/ANode/test/TestEcfFile.cpp b/ANode/test/TestEcfFile.cpp index c84dc9ff1..9bd56715d 100644 --- a/ANode/test/TestEcfFile.cpp +++ b/ANode/test/TestEcfFile.cpp @@ -12,7 +12,6 @@ #include #include -#include #include #include "ecflow/core/Ecf.hpp" @@ -29,7 +28,6 @@ using namespace std; using namespace ecf; -namespace fs = boost::filesystem; BOOST_AUTO_TEST_SUITE(NodeTestSuite) @@ -145,7 +143,7 @@ BOOST_AUTO_TEST_CASE(test_ecf_simple_include_file) { << job_file_contents << "'"); /// Remove all the generated files - boost::filesystem::remove_all(ecf_home + suite->absNodePath()); + fs::remove_all(ecf_home + suite->absNodePath()); } BOOST_AUTO_TEST_CASE(test_ECFLOW_495) { @@ -219,7 +217,7 @@ BOOST_AUTO_TEST_CASE(test_ECFLOW_495) { "Expected\n'" << expected_job_file_contents << "' but found \n'" << job_file_contents << "'"); /// Remove all the generated files - boost::filesystem::remove_all(ecf_home + suite->absNodePath()); + fs::remove_all(ecf_home + suite->absNodePath()); } BOOST_AUTO_TEST_CASE(test_ECF_SCRIPT_CMD_ECFLOW_427) { @@ -361,7 +359,7 @@ BOOST_AUTO_TEST_CASE(test_ECF_SCRIPT_CMD_ECFLOW_427) { } /// Remove all the generated files - boost::filesystem::remove_all(ecf_home + suite->absNodePath()); + fs::remove_all(ecf_home + suite->absNodePath()); } BOOST_AUTO_TEST_CASE(test_ecf_include_file) { @@ -446,7 +444,7 @@ BOOST_AUTO_TEST_CASE(test_ecf_include_file) { "Could not open job file " << job_file_location << " (" << strerror(errno) << ")"); /// Remove all the generated files - boost::filesystem::remove_all(ecf_home + suite->absNodePath()); + fs::remove_all(ecf_home + suite->absNodePath()); } BOOST_AUTO_TEST_CASE(test_ecf_include_multi_paths_ECFLOW_261) { @@ -528,7 +526,7 @@ BOOST_AUTO_TEST_CASE(test_ecf_include_multi_paths_ECFLOW_261) { "Could not open job file " << job_file_location << " (" << strerror(errno) << ")"); /// Remove all the generated files - boost::filesystem::remove_all(ecf_home + suite->absNodePath()); + fs::remove_all(ecf_home + suite->absNodePath()); } BOOST_AUTO_TEST_CASE(test_ecf_include_ECFLOW_274) { @@ -690,7 +688,7 @@ BOOST_AUTO_TEST_CASE(test_ecf_simple_used_variables) { << file_with_used_variables); /// Remove all the generated files - boost::filesystem::remove_all(ecf_home + suite->absNodePath()); + fs::remove_all(ecf_home + suite->absNodePath()); } BOOST_AUTO_TEST_CASE(test_ecf_simple_used_variables_with_comments) { @@ -765,7 +763,7 @@ BOOST_AUTO_TEST_CASE(test_ecf_simple_used_variables_with_comments) { << file_with_used_variables); /// Remove all the generated files - boost::filesystem::remove_all(ecf_home + suite->absNodePath()); + fs::remove_all(ecf_home + suite->absNodePath()); } BOOST_AUTO_TEST_CASE(test_ecf_simple_used_variables_errors) { @@ -830,7 +828,7 @@ BOOST_AUTO_TEST_CASE(test_ecf_simple_used_variables_errors) { BOOST_REQUIRE_THROW(ecfFile.edit_used_variables(file_with_used_variables), std::runtime_error); /// Remove all the generated files - boost::filesystem::remove_all(ecf_home + suite->absNodePath()); + fs::remove_all(ecf_home + suite->absNodePath()); } BOOST_AUTO_TEST_CASE(test_ecf_file) { @@ -1022,11 +1020,11 @@ BOOST_AUTO_TEST_CASE(test_ecf_file) { BOOST_CHECK_MESSAGE(job_file_contents.find("%ecfmicro") == string::npos, "%ecfmicro should have been removed:"); /// Remove all the generated files - boost::filesystem::remove(man_file_location); - boost::filesystem::remove(ecf_file_location); - boost::filesystem::remove(usr_file_location); - boost::filesystem::remove(job_file_location); - boost::filesystem::remove(ecf_home + suite->absNodePath()); + fs::remove(man_file_location); + fs::remove(ecf_file_location); + fs::remove(usr_file_location); + fs::remove(job_file_location); + fs::remove(ecf_home + suite->absNodePath()); } BOOST_AUTO_TEST_CASE(test_ecf_file_includenoop) { @@ -1117,10 +1115,10 @@ BOOST_AUTO_TEST_CASE(test_ecf_file_includenoop) { "%end associated with comment and manual should exist:"); // Remove all the generated files - boost::filesystem::remove(ecf_file_location); - boost::filesystem::remove(man_file_location); - boost::filesystem::remove(job_file_location); - boost::filesystem::remove(ecf_home + suite->absNodePath()); + fs::remove(ecf_file_location); + fs::remove(man_file_location); + fs::remove(job_file_location); + fs::remove(ecf_home + suite->absNodePath()); } BOOST_AUTO_TEST_CASE(test_ecf_file_override_ECF_JOB) { @@ -1199,8 +1197,8 @@ BOOST_AUTO_TEST_CASE(test_ecf_file_override_ECF_JOB) { BOOST_CHECK_MESSAGE(!job_file_contents.empty(), "Job should not be empty"); // Remove all the generated files - boost::filesystem::remove_all(ecf_home + suite->absNodePath()); - boost::filesystem::remove_all(ecf_home + "/a"); + fs::remove_all(ecf_home + suite->absNodePath()); + fs::remove_all(ecf_home + "/a"); /// Destroy System singleton to avoid valgrind from complaining System::destroy(); @@ -1344,7 +1342,7 @@ BOOST_AUTO_TEST_CASE(test_ECFLOW_672) { BOOST_CHECK_MESSAGE(fs::exists(job_file_location), "Expected File " << job_file_location << " to exist"); /// Remove generate file - boost::filesystem::remove(job_file_location); + fs::remove(job_file_location); } static void basic_test_template(const std::string& test_name, @@ -1440,7 +1438,7 @@ static void basic_test_template(const std::string& test_name, } /// Remove all the generated files - boost::filesystem::remove_all(ecf_home + suite->absNodePath()); + fs::remove_all(ecf_home + suite->absNodePath()); } BOOST_AUTO_TEST_CASE(test_includeonce) { diff --git a/ANode/test/TestEcfFileLocator.cpp b/ANode/test/TestEcfFileLocator.cpp index 7f93e34e3..a2874ab94 100644 --- a/ANode/test/TestEcfFileLocator.cpp +++ b/ANode/test/TestEcfFileLocator.cpp @@ -10,7 +10,6 @@ #include -#include #include #include "ecflow/core/File.hpp" @@ -24,7 +23,6 @@ using namespace std; using namespace ecf; -namespace fs = boost::filesystem; BOOST_AUTO_TEST_SUITE(NodeTestSuite) @@ -153,9 +151,9 @@ BOOST_AUTO_TEST_CASE(test_ecf_file_search) { EcfFile::PRUNE_ROOT, __LINE__); // ECF_FILES_LOOKUP make *NO* difference for lookup with EcfFile::ECF_SCRIPT - suite->deleteVariable("ECF_FILES_LOOKUP"); // cleanup - suite->deleteVariable("ECF_FILES"); // cleanup - boost::filesystem::remove(ecf_file_location); // cleanup + suite->deleteVariable("ECF_FILES_LOOKUP"); // cleanup + suite->deleteVariable("ECF_FILES"); // cleanup + fs::remove(ecf_file_location); // cleanup } { // cout << "Test ECF_HOME/ECF_LISTS at root location\n"; @@ -173,9 +171,9 @@ BOOST_AUTO_TEST_CASE(test_ecf_file_search) { suite->add_variable("ECF_FILES_LOOKUP", "prune_leaf"); // change look up method located_ecf_file(task, EcfFile::ECF_FILES, EcfFile::PRUNE_LEAF, __LINE__); - suite->deleteVariable("ECF_FILES_LOOKUP"); // cleanup - suite->deleteVariable("ECF_FILES"); // cleanup - boost::filesystem::remove(ecf_file_location); // cleanup + suite->deleteVariable("ECF_FILES_LOOKUP"); // cleanup + suite->deleteVariable("ECF_FILES"); // cleanup + fs::remove(ecf_file_location); // cleanup } { // cout << "Test ECF_HOME at intermediate location prune_leaf\n"; @@ -195,7 +193,7 @@ BOOST_AUTO_TEST_CASE(test_ecf_file_search) { located_ecf_file(task, EcfFile::ECF_HOME, EcfFile::PRUNE_LEAF, __LINE__); // Remove this file, required for the following test - boost::filesystem::remove(ecf_file_location); + fs::remove(ecf_file_location); // Remove ECF_FILES_LOOKUP variable suite->deleteVariable("ECF_FILES_LOOKUP"); @@ -203,7 +201,7 @@ BOOST_AUTO_TEST_CASE(test_ecf_file_search) { node = node->parent(); } /// Remove all the generated files - boost::filesystem::remove_all(ecf_home + suite->absNodePath()); + fs::remove_all(ecf_home + suite->absNodePath()); } { // cout << "Test ECF_FILES at intermediate location, by prune_leaf\n"; @@ -224,7 +222,7 @@ BOOST_AUTO_TEST_CASE(test_ecf_file_search) { located_ecf_file(task, EcfFile::ECF_FILES, EcfFile::PRUNE_LEAF, __LINE__); // Remove this file, required for the following test - boost::filesystem::remove(ecf_file_location); + fs::remove(ecf_file_location); // Remove ECF_FILES_LOOKUP variable suite->deleteVariable("ECF_FILES_LOOKUP"); @@ -233,7 +231,7 @@ BOOST_AUTO_TEST_CASE(test_ecf_file_search) { } /// Remove all the generated files - boost::filesystem::remove_all(ecf_home + suite->absNodePath()); + fs::remove_all(ecf_home + suite->absNodePath()); } } diff --git a/ANode/test/TestJobProfiler.cpp b/ANode/test/TestJobProfiler.cpp index 1f135a8b9..12af61795 100644 --- a/ANode/test/TestJobProfiler.cpp +++ b/ANode/test/TestJobProfiler.cpp @@ -10,7 +10,6 @@ #include -#include #include #include "ecflow/core/File.hpp" @@ -25,7 +24,6 @@ using namespace std; using namespace ecf; -namespace fs = boost::filesystem; BOOST_AUTO_TEST_SUITE(NodeTestSuite) diff --git a/ANode/test/TestMigration.cpp b/ANode/test/TestMigration.cpp index a62a9bca3..3b7641640 100644 --- a/ANode/test/TestMigration.cpp +++ b/ANode/test/TestMigration.cpp @@ -8,7 +8,6 @@ * nor does it submit to any jurisdiction. */ -#include #include #include "MyDefsFixture.hpp" @@ -24,7 +23,6 @@ using namespace std; using namespace ecf; using namespace boost::posix_time; using namespace boost::gregorian; -namespace fs = boost::filesystem; // #define UPDATE_TESTS 1 diff --git a/ANode/test/TestPersistence.cpp b/ANode/test/TestPersistence.cpp index e72346398..7c89945d7 100644 --- a/ANode/test/TestPersistence.cpp +++ b/ANode/test/TestPersistence.cpp @@ -8,15 +8,14 @@ * nor does it submit to any jurisdiction. */ -#include #include #include "MyDefsFixture.hpp" +#include "ecflow/core/Filesystem.hpp" #include "ecflow/node/Defs.hpp" using namespace std; using namespace ecf; -namespace fs = boost::filesystem; BOOST_FIXTURE_TEST_SUITE(NodeTestSuite, MyDefsFixture) diff --git a/ANode/test/TestPreProcessing.cpp b/ANode/test/TestPreProcessing.cpp index d6679660f..4afefb82e 100644 --- a/ANode/test/TestPreProcessing.cpp +++ b/ANode/test/TestPreProcessing.cpp @@ -11,8 +11,6 @@ #include #include -#include -#include #include #include "ecflow/core/Ecf.hpp" @@ -27,7 +25,6 @@ using namespace std; using namespace ecf; -namespace fs = boost::filesystem; void findVariable(std::string& line, std::set& variables) { // scan for variables @@ -71,8 +68,7 @@ void findVariable(std::string& line, std::set& variables) { } void autoDiscoverVariables(const std::string& directory, std::set& variables) { - fs::path full_path(fs::initial_path()); - full_path = fs::system_complete(fs::path(directory)); + auto full_path = fs::absolute(directory); BOOST_CHECK(fs::exists(full_path)); BOOST_CHECK(fs::is_directory(full_path)); @@ -113,8 +109,7 @@ void test_sms_preprocessing(const std::string& directory, bool pass) { // SET ECF_HOME std::string ecf_home = directory; - fs::path full_path(fs::initial_path()); - full_path = fs::system_complete(fs::path(directory)); + auto full_path = fs::absolute(directory); BOOST_CHECK(fs::exists(full_path)); BOOST_CHECK(fs::is_directory(full_path)); diff --git a/ANode/test/TestSystem.cpp b/ANode/test/TestSystem.cpp index 70bd9d976..2470c4ee8 100644 --- a/ANode/test/TestSystem.cpp +++ b/ANode/test/TestSystem.cpp @@ -10,15 +10,14 @@ #include -#include #include +#include "ecflow/core/Filesystem.hpp" #include "ecflow/node/Signal.hpp" #include "ecflow/node/System.hpp" using namespace std; using namespace ecf; -namespace fs = boost::filesystem; BOOST_AUTO_TEST_SUITE(NodeTestSuite) diff --git a/ANode/test/TestTaskScriptGenerator.cpp b/ANode/test/TestTaskScriptGenerator.cpp index 8b44dc0be..f2b41a4c7 100644 --- a/ANode/test/TestTaskScriptGenerator.cpp +++ b/ANode/test/TestTaskScriptGenerator.cpp @@ -11,7 +11,6 @@ #include #include -#include #include #include "MyDefsFixture.hpp" @@ -27,7 +26,6 @@ using namespace std; using namespace ecf; -namespace fs = boost::filesystem; BOOST_AUTO_TEST_SUITE(NodeTestSuite) diff --git a/ANode/test/parser/ParseTimer.cpp b/ANode/test/parser/ParseTimer.cpp index 6e776dd22..60b82ad3c 100644 --- a/ANode/test/parser/ParseTimer.cpp +++ b/ANode/test/parser/ParseTimer.cpp @@ -13,8 +13,6 @@ #include #include -#include -#include #include #include "PersistHelper.hpp" @@ -36,7 +34,6 @@ using namespace std; using namespace ecf; using namespace boost::timer; -namespace fs = boost::filesystem; // This test is used to find a task given a path of the form: // suite/family/task diff --git a/ANode/test/parser/PersistHelper.cpp b/ANode/test/parser/PersistHelper.cpp index 0bd408432..4831b1bc1 100644 --- a/ANode/test/parser/PersistHelper.cpp +++ b/ANode/test/parser/PersistHelper.cpp @@ -12,14 +12,11 @@ #include -#include - #include "TemporaryFile.hpp" #include "ecflow/core/Ecf.hpp" #include "ecflow/core/File.hpp" #include "ecflow/node/Defs.hpp" -namespace fs = boost::filesystem; using namespace std; using namespace ecf; diff --git a/ANode/test/parser/TemporaryFile.hpp b/ANode/test/parser/TemporaryFile.hpp index cb6a0aef9..b7d42cf56 100644 --- a/ANode/test/parser/TemporaryFile.hpp +++ b/ANode/test/parser/TemporaryFile.hpp @@ -13,9 +13,7 @@ #include -#include - -namespace fs = boost::filesystem; +#include "ecflow/core/Filesystem.hpp" class TemporaryFile { public: diff --git a/ANode/test/parser/TestAutoAddExterns.cpp b/ANode/test/parser/TestAutoAddExterns.cpp index 2723d46b8..caff59747 100644 --- a/ANode/test/parser/TestAutoAddExterns.cpp +++ b/ANode/test/parser/TestAutoAddExterns.cpp @@ -11,13 +11,11 @@ #include #include -#include #include #include "ecflow/core/File.hpp" #include "ecflow/node/Defs.hpp" -namespace fs = boost::filesystem; using namespace std; using namespace ecf; diff --git a/ANode/test/parser/TestParser.cpp b/ANode/test/parser/TestParser.cpp index 2c0514fe6..ceb7757d2 100644 --- a/ANode/test/parser/TestParser.cpp +++ b/ANode/test/parser/TestParser.cpp @@ -11,8 +11,6 @@ #include #include -#include -#include #include #include "PersistHelper.hpp" @@ -21,9 +19,7 @@ #include "ecflow/node/Defs.hpp" #include "ecflow/node/Node.hpp" #include "ecflow/node/parser/DefsStructureParser.hpp" -// #include "ecflow/core/PrintStyle.hpp" -namespace fs = boost::filesystem; using namespace std; using namespace ecf; @@ -34,8 +30,7 @@ std::vector defs_with_expected_warnings() { BOOST_AUTO_TEST_SUITE(ParserTestSuite) void test_defs(const std::string& directory, bool pass) { - fs::path full_path(fs::initial_path()); - full_path = fs::system_complete(fs::path(directory)); + auto full_path = fs::absolute(directory); BOOST_CHECK(fs::exists(full_path)); BOOST_CHECK(fs::is_directory(full_path)); @@ -173,8 +168,7 @@ BOOST_AUTO_TEST_CASE(test_parsing_for_good_defs_state) { } void test_node_defs(const std::string& directory, bool pass) { - fs::path full_path(fs::initial_path()); - full_path = fs::system_complete(fs::path(directory)); + auto full_path = fs::absolute(directory); BOOST_CHECK(fs::exists(full_path)); BOOST_CHECK(fs::is_directory(full_path)); diff --git a/ANode/test/parser/TestSingleDefsFile.cpp b/ANode/test/parser/TestSingleDefsFile.cpp index 60453c438..26ac2d82a 100644 --- a/ANode/test/parser/TestSingleDefsFile.cpp +++ b/ANode/test/parser/TestSingleDefsFile.cpp @@ -13,8 +13,6 @@ #include #include -#include -#include #include #include @@ -34,7 +32,6 @@ #include "ecflow/node/Task.hpp" #include "ecflow/node/parser/DefsStructureParser.hpp" -namespace fs = boost::filesystem; using namespace std; using namespace ecf; using namespace boost::posix_time; diff --git a/Base/src/ecflow/base/ClientToServerRequest.hpp b/Base/src/ecflow/base/ClientToServerRequest.hpp index 3374f1140..7dda5b083 100644 --- a/Base/src/ecflow/base/ClientToServerRequest.hpp +++ b/Base/src/ecflow/base/ClientToServerRequest.hpp @@ -11,16 +11,17 @@ #ifndef ecflow_base_ClientToServerRequest_HPP #define ecflow_base_ClientToServerRequest_HPP -#include - #include "ecflow/base/cts/ClientToServerCmd.hpp" // Base class for client to server requesting. // This class is used in the IPC messaging from client to server. -class ClientToServerRequest : private boost::noncopyable { +class ClientToServerRequest { public: - ClientToServerRequest() = default; - ~ClientToServerRequest() = default; + ClientToServerRequest() = default; + ClientToServerRequest(const ClientToServerRequest&) = delete; + ~ClientToServerRequest() = default; + + ClientToServerRequest& operator=(const ClientToServerRequest&) = delete; void set_cmd(const Cmd_ptr& cmd) { cmd_ = cmd; diff --git a/Base/src/ecflow/base/Gnuplot.cpp b/Base/src/ecflow/base/Gnuplot.cpp index 9cceef11c..b3d068099 100644 --- a/Base/src/ecflow/base/Gnuplot.cpp +++ b/Base/src/ecflow/base/Gnuplot.cpp @@ -16,7 +16,6 @@ #include #include -#include #include // for chmod #include "ecflow/core/File.hpp" @@ -26,7 +25,6 @@ #include "ecflow/core/Str.hpp" using namespace std; -namespace fs = boost::filesystem; namespace ecf { diff --git a/Base/src/ecflow/base/Gnuplot.hpp b/Base/src/ecflow/base/Gnuplot.hpp index 40119343d..166ee3507 100644 --- a/Base/src/ecflow/base/Gnuplot.hpp +++ b/Base/src/ecflow/base/Gnuplot.hpp @@ -14,8 +14,6 @@ #include #include -#include - #include "ecflow/core/Host.hpp" /// @@ -24,13 +22,17 @@ namespace ecf { -class Gnuplot : private boost::noncopyable { +class Gnuplot { public: + Gnuplot() = delete; + Gnuplot(const Gnuplot&) = delete; Gnuplot(const std::string& log_file, const std::string& host, const std::string& port, size_t no_of_suites_to_plot = 5); + Gnuplot& operator=(const Gnuplot&) = delete; + /// parse the log file and show gnuplot of server load /// Include the suite most contributing to the load /// generates two files diff --git a/Base/src/ecflow/base/Openssl.cpp b/Base/src/ecflow/base/Openssl.cpp index fa9180d20..b6c6e32b7 100644 --- a/Base/src/ecflow/base/Openssl.cpp +++ b/Base/src/ecflow/base/Openssl.cpp @@ -14,14 +14,11 @@ #include // getenv #include -#include - #include "ecflow/core/File.hpp" #include "ecflow/core/Host.hpp" #include "ecflow/core/Str.hpp" using namespace std; -namespace fs = boost::filesystem; namespace ecf { diff --git a/Base/src/ecflow/base/ServerToClientResponse.hpp b/Base/src/ecflow/base/ServerToClientResponse.hpp index ac61e0d0c..6a3e00d65 100644 --- a/Base/src/ecflow/base/ServerToClientResponse.hpp +++ b/Base/src/ecflow/base/ServerToClientResponse.hpp @@ -11,17 +11,18 @@ #ifndef ecflow_base_ServerToClientResponse_HPP #define ecflow_base_ServerToClientResponse_HPP -#include - #include "ecflow/base/stc/ServerToClientCmd.hpp" // Base class for server to client requesting. This class is used in the IPC messaging between // server and client -class ServerToClientResponse : private boost::noncopyable { +class ServerToClientResponse { public: - ServerToClientResponse() = default; + ServerToClientResponse() = default; + ServerToClientResponse(const ServerToClientResponse&) = delete; explicit ServerToClientResponse(const STC_Cmd_ptr& cmd) : stc_cmd_(cmd) {} - ~ServerToClientResponse() = default; + ~ServerToClientResponse() = default; + + ServerToClientResponse& operator=(const ServerToClientResponse&) = delete; STC_Cmd_ptr get_cmd() const { return stc_cmd_; } void set_cmd(const STC_Cmd_ptr& cmd) { stc_cmd_ = cmd; } diff --git a/Base/src/ecflow/base/WhyCmd.hpp b/Base/src/ecflow/base/WhyCmd.hpp index 5d8fcda4e..1266f2409 100644 --- a/Base/src/ecflow/base/WhyCmd.hpp +++ b/Base/src/ecflow/base/WhyCmd.hpp @@ -19,12 +19,14 @@ #include -#include - #include "ecflow/node/NodeFwd.hpp" -class WhyCmd : private boost::noncopyable { +class WhyCmd { public: + WhyCmd() = delete; + WhyCmd(const WhyCmd&) = delete; + WhyCmd(WhyCmd&&) = delete; + WhyCmd(defs_ptr defs, const std::string& absNodePath); /// Why the node is not running diff --git a/Base/src/ecflow/base/ZombieCtrl.hpp b/Base/src/ecflow/base/ZombieCtrl.hpp index e1c26d8bc..f2501207f 100644 --- a/Base/src/ecflow/base/ZombieCtrl.hpp +++ b/Base/src/ecflow/base/ZombieCtrl.hpp @@ -11,7 +11,6 @@ #ifndef ecflow_base_ZombieCtrl_HPP #define ecflow_base_ZombieCtrl_HPP -#include #include #include "ecflow/attribute/Zombie.hpp" @@ -26,9 +25,14 @@ class AbstractServer; /// /// All zombies are auto deleted after a period of time. See Zombie::allowed_age() -class ZombieCtrl : private boost::noncopyable { +class ZombieCtrl { public: - ZombieCtrl() = default; + ZombieCtrl() = default; + ZombieCtrl(const ZombieCtrl&) = delete; + ZombieCtrl(ZombieCtrl&&) = delete; + + ZombieCtrl& operator=(const ZombieCtrl&) = delete; + ZombieCtrl& operator=(ZombieCtrl&&) = delete; /// Handle the zombie, and return back to the client bool handle_zombie(Submittable*, // Must be NON NULL @@ -130,4 +134,5 @@ class ZombieCtrl : private boost::noncopyable { private: std::vector zombies_; }; -#endif + +#endif /* ecflow_base_ZombieCtrl_HPP */ diff --git a/Base/src/ecflow/base/cts/CFileCmd.cpp b/Base/src/ecflow/base/cts/CFileCmd.cpp index c29ae0d8c..2c5f92603 100644 --- a/Base/src/ecflow/base/cts/CFileCmd.cpp +++ b/Base/src/ecflow/base/cts/CFileCmd.cpp @@ -11,8 +11,6 @@ #include #include -#include - #include "ecflow/base/AbstractClientEnv.hpp" #include "ecflow/base/AbstractServer.hpp" #include "ecflow/base/cts/ClientToServerCmd.hpp" @@ -27,7 +25,6 @@ using namespace ecf; using namespace std; using namespace boost; namespace po = boost::program_options; -namespace fs = boost::filesystem; CFileCmd::CFileCmd(const std::string& pathToNode, const std::string& file_type, const std::string& input_max_lines) : pathToNode_(pathToNode), diff --git a/Base/src/ecflow/base/cts/EditHistoryMgr.hpp b/Base/src/ecflow/base/cts/EditHistoryMgr.hpp index 1a62ed8c2..d95b07bbe 100644 --- a/Base/src/ecflow/base/cts/EditHistoryMgr.hpp +++ b/Base/src/ecflow/base/cts/EditHistoryMgr.hpp @@ -11,8 +11,6 @@ #ifndef ecflow_base_cts_EditHistoryMgr_HPP #define ecflow_base_cts_EditHistoryMgr_HPP -#include - class ClientToServerCmd; class AbstractServer; @@ -24,11 +22,15 @@ class AbstractServer; /// return ClientToServerCmd::isWrite() true. /// -class EditHistoryMgr : private boost::noncopyable { +class EditHistoryMgr { public: + EditHistoryMgr() = delete; + EditHistoryMgr(const EditHistoryMgr&) = delete; EditHistoryMgr(const ClientToServerCmd*, AbstractServer*); ~EditHistoryMgr(); + EditHistoryMgr& operator=(const EditHistoryMgr&) = delete; + private: const ClientToServerCmd* cts_cmd_; AbstractServer* as_; diff --git a/Base/src/ecflow/base/cts/EditScriptCmd.cpp b/Base/src/ecflow/base/cts/EditScriptCmd.cpp index 28c5d490c..2f9fa6314 100644 --- a/Base/src/ecflow/base/cts/EditScriptCmd.cpp +++ b/Base/src/ecflow/base/cts/EditScriptCmd.cpp @@ -10,8 +10,6 @@ #include -#include - #include "ecflow/base/AbstractClientEnv.hpp" #include "ecflow/base/AbstractServer.hpp" #include "ecflow/base/cts/ClientToServerCmd.hpp" @@ -27,7 +25,6 @@ using namespace ecf; using namespace std; using namespace boost; namespace po = boost::program_options; -namespace fs = boost::filesystem; bool EditScriptCmd::equals(ClientToServerCmd* rhs) const { auto* the_rhs = dynamic_cast(rhs); diff --git a/Base/src/ecflow/base/cts/LoadDefsCmd.cpp b/Base/src/ecflow/base/cts/LoadDefsCmd.cpp index fcb291cd5..564fd5fb8 100644 --- a/Base/src/ecflow/base/cts/LoadDefsCmd.cpp +++ b/Base/src/ecflow/base/cts/LoadDefsCmd.cpp @@ -10,12 +10,11 @@ #include -#include - #include "ecflow/base/AbstractClientEnv.hpp" #include "ecflow/base/AbstractServer.hpp" #include "ecflow/base/cts/ClientToServerCmd.hpp" #include "ecflow/base/cts/CtsApi.hpp" +#include "ecflow/core/Filesystem.hpp" #include "ecflow/core/Log.hpp" #include "ecflow/core/PrintStyle.hpp" #include "ecflow/node/Defs.hpp" @@ -55,7 +54,7 @@ LoadDefsCmd::LoadDefsCmd(const std::string& defs_filename, load_ok = defs->restore_from_string(defs_filename, errMsg, warningMsg); defs_filename_ = ""; } - else if (boost::filesystem::exists(defs_filename)) { + else if (fs::exists(defs_filename)) { // defs_filename is actually a file, open the file and read it. This is the method // when loading definitions with ecflow_client diff --git a/Base/src/ecflow/base/stc/DefsCache.hpp b/Base/src/ecflow/base/stc/DefsCache.hpp index 0eb144fd8..7acae601b 100644 --- a/Base/src/ecflow/base/stc/DefsCache.hpp +++ b/Base/src/ecflow/base/stc/DefsCache.hpp @@ -11,8 +11,6 @@ #ifndef ecflow_base_cts_DefsCache_HPP #define ecflow_base_cts_DefsCache_HPP -#include - #include "ecflow/node/NodeFwd.hpp" //================================================================================ @@ -43,8 +41,12 @@ // client3: --------------> get---------------> Server // serialise---------<----return cache //================================================================================ -class DefsCache : private boost::noncopyable { +class DefsCache { public: + DefsCache() = delete; + DefsCache(const DefsCache&) = delete; + DefsCache& operator=(const DefsCache&) = delete; + // Server side static void update_cache_if_state_changed(Defs* defs); static void update_cache(Defs* defs); @@ -57,8 +59,6 @@ class DefsCache : private boost::noncopyable { friend class SSyncCmd; friend class DefsCmd; - DefsCache() = delete; - ~DefsCache() = delete; static std::string full_server_defs_as_string_; static unsigned int state_change_no_; // detect state change in defs across clients static unsigned int modify_change_no_; // detect state change in defs across clients diff --git a/Base/src/ecflow/base/stc/PreAllocatedReply.hpp b/Base/src/ecflow/base/stc/PreAllocatedReply.hpp index cbd9e6754..7790d8aa1 100644 --- a/Base/src/ecflow/base/stc/PreAllocatedReply.hpp +++ b/Base/src/ecflow/base/stc/PreAllocatedReply.hpp @@ -13,11 +13,10 @@ #include -#include - #include "ecflow/base/Cmd.hpp" #include "ecflow/core/Child.hpp" #include "ecflow/node/NodeFwd.hpp" + class AbstractServer; // class PreAllocatedReply: @@ -25,8 +24,12 @@ class AbstractServer; // This will help to reduce memory fragmentation. // Since the commands are re-used those commands with state, // should be cleared first -class PreAllocatedReply : private boost::noncopyable { +class PreAllocatedReply { public: + PreAllocatedReply() = delete; + PreAllocatedReply(const PreAllocatedReply&) = delete; + PreAllocatedReply& operator=(const PreAllocatedReply&) = delete; + static STC_Cmd_ptr ok_cmd(); static STC_Cmd_ptr block_client_server_halted_cmd(); static STC_Cmd_ptr block_client_on_home_server_cmd(); diff --git a/Base/test/MockServer.hpp b/Base/test/MockServer.hpp index 93ab92c87..652a7a2dc 100644 --- a/Base/test/MockServer.hpp +++ b/Base/test/MockServer.hpp @@ -13,8 +13,6 @@ #include -#include - #include "ecflow/base/AbstractServer.hpp" #include "ecflow/core/Ecf.hpp" // In server we increment modify and state change numbers, #include "ecflow/core/Log.hpp" @@ -149,11 +147,15 @@ class MockServer : public AbstractServer { /// o Ecf::set_server(true): This controls incrementing of state/modify change numbers /// which should *only* be done on the server side /// o Update Suite state/modify change number -class MockSuiteChangedServer : private boost::noncopyable { +class MockSuiteChangedServer { public: + MockSuiteChangedServer() = delete; + MockSuiteChangedServer(const MockSuiteChangedServer&) = delete; explicit MockSuiteChangedServer(suite_ptr suite) : suiteChanged_(suite) { Ecf::set_server(true); } ~MockSuiteChangedServer() { Ecf::set_server(false); } + MockSuiteChangedServer& operator=(const MockSuiteChangedServer&) = delete; + private: ecf::SuiteChanged suiteChanged_; }; diff --git a/Base/test/TestAlterCmd.cpp b/Base/test/TestAlterCmd.cpp index 5bb7105c7..5a0b3ad6b 100644 --- a/Base/test/TestAlterCmd.cpp +++ b/Base/test/TestAlterCmd.cpp @@ -8,7 +8,6 @@ * nor does it submit to any jurisdiction. */ -#include #include #include "TestHelper.hpp" @@ -26,7 +25,6 @@ using namespace std; using namespace ecf; -namespace fs = boost::filesystem; BOOST_AUTO_TEST_SUITE(BaseTestSuite) diff --git a/Base/test/TestArchiveAndRestoreCmd.cpp b/Base/test/TestArchiveAndRestoreCmd.cpp index 7a404772c..7922a8ae4 100644 --- a/Base/test/TestArchiveAndRestoreCmd.cpp +++ b/Base/test/TestArchiveAndRestoreCmd.cpp @@ -8,7 +8,6 @@ * nor does it submit to any jurisdiction. */ -#include #include #include "TestHelper.hpp" @@ -20,11 +19,9 @@ #include "ecflow/node/Family.hpp" #include "ecflow/node/Suite.hpp" #include "ecflow/node/System.hpp" -// #include "ecflow/core/PrintStyle.hpp" using namespace std; using namespace ecf; -namespace fs = boost::filesystem; BOOST_AUTO_TEST_SUITE(BaseTestSuite) diff --git a/Base/test/TestClientHandleCmd.cpp b/Base/test/TestClientHandleCmd.cpp index 337536392..184756151 100644 --- a/Base/test/TestClientHandleCmd.cpp +++ b/Base/test/TestClientHandleCmd.cpp @@ -8,7 +8,6 @@ * nor does it submit to any jurisdiction. */ -#include #include #include "TestHelper.hpp" @@ -18,7 +17,6 @@ using namespace std; using namespace ecf; -namespace fs = boost::filesystem; // The client handle commands do not change state & modify change number, hence need to bypass these checks static bool bypass_state_modify_change_check = false; diff --git a/Base/test/TestForceCmd.cpp b/Base/test/TestForceCmd.cpp index cdc70ac48..daaf5a5de 100644 --- a/Base/test/TestForceCmd.cpp +++ b/Base/test/TestForceCmd.cpp @@ -10,7 +10,6 @@ #include -#include #include // IWYU pragma: keep #include "MockServer.hpp" @@ -23,7 +22,6 @@ using namespace std; using namespace ecf; -namespace fs = boost::filesystem; BOOST_AUTO_TEST_SUITE(BaseTestSuite) diff --git a/Base/test/TestInLimitAndLimit.cpp b/Base/test/TestInLimitAndLimit.cpp index dbc762a40..1164dc250 100644 --- a/Base/test/TestInLimitAndLimit.cpp +++ b/Base/test/TestInLimitAndLimit.cpp @@ -12,7 +12,6 @@ #include #include -#include #include #include "TestHelper.hpp" @@ -28,7 +27,6 @@ using namespace std; using namespace ecf; -namespace fs = boost::filesystem; BOOST_AUTO_TEST_SUITE(BaseTestSuite) diff --git a/Base/test/TestJobGenPerf.cpp b/Base/test/TestJobGenPerf.cpp index c0429dd3b..487ddb81c 100644 --- a/Base/test/TestJobGenPerf.cpp +++ b/Base/test/TestJobGenPerf.cpp @@ -12,9 +12,6 @@ #include #include -#include -#include - #include "ecflow/attribute/Variable.hpp" #include "ecflow/core/File.hpp" #include "ecflow/core/Log.hpp" @@ -27,7 +24,6 @@ using namespace std; using namespace ecf; -namespace fs = boost::filesystem; // #define DEBUG 1 diff --git a/Base/test/TestLogCmd.cpp b/Base/test/TestLogCmd.cpp index c36cb617c..3b9dd7058 100644 --- a/Base/test/TestLogCmd.cpp +++ b/Base/test/TestLogCmd.cpp @@ -8,7 +8,6 @@ * nor does it submit to any jurisdiction. */ -#include #include #include "TestHelper.hpp" @@ -19,7 +18,6 @@ #include "ecflow/node/Defs.hpp" using namespace boost; -namespace fs = boost::filesystem; using namespace std; using namespace ecf; diff --git a/Base/test/TestRequest.cpp b/Base/test/TestRequest.cpp index 034f267f3..05c72a220 100644 --- a/Base/test/TestRequest.cpp +++ b/Base/test/TestRequest.cpp @@ -8,7 +8,6 @@ * nor does it submit to any jurisdiction. */ -#include #include #include "MyDefsFixture.hpp" @@ -28,7 +27,6 @@ using namespace std; using namespace ecf; -namespace fs = boost::filesystem; BOOST_FIXTURE_TEST_SUITE(BaseTestSuite, MyDefsFixture) diff --git a/Base/test/TestRequeueNodeCmd.cpp b/Base/test/TestRequeueNodeCmd.cpp index 6fc974363..304313c8f 100644 --- a/Base/test/TestRequeueNodeCmd.cpp +++ b/Base/test/TestRequeueNodeCmd.cpp @@ -8,7 +8,6 @@ * nor does it submit to any jurisdiction. */ -#include #include #include "TestHelper.hpp" @@ -25,7 +24,6 @@ using namespace std; using namespace ecf; using namespace boost::gregorian; using namespace boost::posix_time; -namespace fs = boost::filesystem; BOOST_AUTO_TEST_SUITE(BaseTestSuite) diff --git a/CSim/src/ecflow/simulator/Simulator.cpp b/CSim/src/ecflow/simulator/Simulator.cpp index adabefc28..f6c82ca54 100644 --- a/CSim/src/ecflow/simulator/Simulator.cpp +++ b/CSim/src/ecflow/simulator/Simulator.cpp @@ -11,7 +11,6 @@ #include "ecflow/simulator/Simulator.hpp" #include // requires boost date and time lib -#include #include "ecflow/attribute/QueueAttr.hpp" #include "ecflow/core/CalendarUpdateParams.hpp" @@ -29,7 +28,6 @@ using namespace boost::gregorian; using namespace boost::posix_time; using namespace std; using namespace ecf; -namespace fs = boost::filesystem; // #define DEBUG_LONG_RUNNING_SUITES 1 diff --git a/CSim/src/ecflow/simulator/Simulator.hpp b/CSim/src/ecflow/simulator/Simulator.hpp index af6df118e..ee9df2530 100644 --- a/CSim/src/ecflow/simulator/Simulator.hpp +++ b/CSim/src/ecflow/simulator/Simulator.hpp @@ -15,8 +15,6 @@ #include #include -#include - #include "ecflow/core/PrintStyle.hpp" class QueueAttr; @@ -32,7 +30,7 @@ namespace ecf { // c/ Tells you about any deadlocks, ie if suite does not complete // d/ Will simulate for both real and hybrid clocks // e/ Simulation will by default run for a year. Should really use start/end clock for accurate simulations -class Simulator : private boost::noncopyable { +class Simulator { public: // For deterministic results simulate using clock(start) and endclock(finish) // Otherwise default to run simulation for: @@ -43,6 +41,8 @@ class Simulator : private boost::noncopyable { // cron // 1 year // repeat // 1 year Simulator(); + Simulator(const Simulator&) = delete; + Simulator& operator=(const Simulator&) = delete; /// return true if all ok else returns false; bool run(Defs&, const std::string& defs_filename, std::string& errorMsg, bool do_checks = true) const; diff --git a/CSim/test/TestAnalysis.cpp b/CSim/test/TestAnalysis.cpp index d0af42b13..9436e7cd6 100644 --- a/CSim/test/TestAnalysis.cpp +++ b/CSim/test/TestAnalysis.cpp @@ -10,10 +10,10 @@ #include -#include #include #include "TestUtil.hpp" +#include "ecflow/core/Filesystem.hpp" #include "ecflow/node/Defs.hpp" #include "ecflow/node/Family.hpp" #include "ecflow/node/Suite.hpp" @@ -24,8 +24,6 @@ using namespace std; using namespace ecf; -namespace fs = boost::filesystem; - BOOST_AUTO_TEST_SUITE(SimulatorTestSuite) /// Use this class to test single simulation of definition file that we want to add @@ -62,8 +60,8 @@ BOOST_AUTO_TEST_CASE(test_analysys) { BOOST_CHECK_MESSAGE(!simulator.run(theDefs, TestUtil::testDataLocation("test_analysys.def"), errorMsg), errorMsg); // cout << theDefs << "\n"; - boost::filesystem::remove("defs.depth"); - boost::filesystem::remove("defs.flat"); + fs::remove("defs.depth"); + fs::remove("defs.flat"); // remove generated log file. Comment out to debug std::string logFileName = TestUtil::testDataLocation("test_analysys.def") + ".log"; diff --git a/CSim/test/TestAutoArchive.cpp b/CSim/test/TestAutoArchive.cpp index 6b0c20eb7..c7822c54e 100644 --- a/CSim/test/TestAutoArchive.cpp +++ b/CSim/test/TestAutoArchive.cpp @@ -11,7 +11,6 @@ #include #include -#include #include #include "TestUtil.hpp" @@ -29,8 +28,6 @@ using namespace ecf; using namespace boost::gregorian; using namespace boost::posix_time; -namespace fs = boost::filesystem; - /// Simulate definition files that are created on then fly. This allows us to validate /// Defs file, to check for correctness diff --git a/CSim/test/TestAutoCancel.cpp b/CSim/test/TestAutoCancel.cpp index 7cc18df40..3ce592081 100644 --- a/CSim/test/TestAutoCancel.cpp +++ b/CSim/test/TestAutoCancel.cpp @@ -11,11 +11,11 @@ #include #include -#include #include #include "TestUtil.hpp" #include "ecflow/attribute/AutoCancelAttr.hpp" +#include "ecflow/core/Filesystem.hpp" #include "ecflow/node/Defs.hpp" #include "ecflow/node/Family.hpp" #include "ecflow/node/Suite.hpp" @@ -27,8 +27,6 @@ using namespace ecf; using namespace boost::gregorian; using namespace boost::posix_time; -namespace fs = boost::filesystem; - /// Simulate definition files that are created on then fly. This us to validate /// Defs file, to check for correctness diff --git a/CSim/test/TestAutoRestore.cpp b/CSim/test/TestAutoRestore.cpp index 7cab48407..7f578caeb 100644 --- a/CSim/test/TestAutoRestore.cpp +++ b/CSim/test/TestAutoRestore.cpp @@ -11,7 +11,6 @@ #include #include -#include #include #include "TestUtil.hpp" @@ -30,8 +29,6 @@ using namespace ecf; using namespace boost::gregorian; using namespace boost::posix_time; -namespace fs = boost::filesystem; - /// Simulate definition files that are created on then fly. This allows us to validate /// Defs file, to check for correctness diff --git a/CSim/test/TestMeter.cpp b/CSim/test/TestMeter.cpp index dc26fbf29..7c1cf7581 100644 --- a/CSim/test/TestMeter.cpp +++ b/CSim/test/TestMeter.cpp @@ -11,11 +11,11 @@ #include #include -#include #include #include "TestUtil.hpp" #include "ecflow/attribute/VerifyAttr.hpp" +#include "ecflow/core/Filesystem.hpp" #include "ecflow/node/Defs.hpp" #include "ecflow/node/Family.hpp" #include "ecflow/node/Suite.hpp" @@ -28,8 +28,6 @@ using namespace ecf; using namespace boost::gregorian; using namespace boost::posix_time; -namespace fs = boost::filesystem; - /// Simulate definition files that are created on then fly. This us to validate /// Defs file, to check for correctness diff --git a/CSim/test/TestRepeat.cpp b/CSim/test/TestRepeat.cpp index bfc49fb42..f6e873745 100644 --- a/CSim/test/TestRepeat.cpp +++ b/CSim/test/TestRepeat.cpp @@ -11,12 +11,12 @@ #include #include -#include #include #include "TestUtil.hpp" #include "ecflow/attribute/VerifyAttr.hpp" #include "ecflow/core/Converter.hpp" +#include "ecflow/core/Filesystem.hpp" #include "ecflow/node/Defs.hpp" #include "ecflow/node/Family.hpp" #include "ecflow/node/Suite.hpp" @@ -28,8 +28,6 @@ using namespace ecf; using namespace boost::gregorian; using namespace boost::posix_time; -namespace fs = boost::filesystem; - /// Simulate definition files that are created on then fly. This us to validate /// Defs file, to check for correctness diff --git a/CSim/test/TestSimulator.cpp b/CSim/test/TestSimulator.cpp index 2175f6090..8d42e5a11 100644 --- a/CSim/test/TestSimulator.cpp +++ b/CSim/test/TestSimulator.cpp @@ -11,8 +11,6 @@ #include #include -#include -#include #define BOOST_TEST_MODULE TestSimulator #include @@ -20,16 +18,13 @@ #include "ecflow/node/System.hpp" #include "ecflow/simulator/Simulator.hpp" -namespace fs = boost::filesystem; - using namespace std; using namespace ecf; BOOST_AUTO_TEST_SUITE(SimulatorTestSuite) void simulate(const std::string& directory, bool pass) { - fs::path full_path(fs::initial_path()); - full_path = fs::system_complete(fs::path(directory)); + auto full_path = fs::absolute(directory); BOOST_CHECK(fs::exists(full_path)); BOOST_CHECK(fs::is_directory(full_path)); diff --git a/CSim/test/TestSingleSimulator.cpp b/CSim/test/TestSingleSimulator.cpp index 26f5a961a..95c91dce4 100644 --- a/CSim/test/TestSingleSimulator.cpp +++ b/CSim/test/TestSingleSimulator.cpp @@ -8,13 +8,10 @@ * nor does it submit to any jurisdiction. */ -#include #include #include #include -#include -#include #define BOOST_TEST_MODULE TestSingleSimulator #include @@ -32,7 +29,6 @@ using namespace std; using namespace ecf; using namespace boost::gregorian; using namespace boost::posix_time; -namespace fs = boost::filesystem; BOOST_AUTO_TEST_SUITE(SimulatorTestSuite) @@ -73,8 +69,8 @@ BOOST_AUTO_TEST_SUITE(SimulatorTestSuite) // fs::remove(logFileName); // // // cout << theDefs << "\n"; -// boost::filesystem::remove("defs.depth"); -// boost::filesystem::remove("defs.flat"); +// fs::remove("defs.depth"); +// fs::remove("defs.flat"); // // /// Destroy singleton's to avoid valgrind from complaining // System::destroy(); diff --git a/CSim/test/TestTime.cpp b/CSim/test/TestTime.cpp index 8f94922d6..5bb5dc179 100644 --- a/CSim/test/TestTime.cpp +++ b/CSim/test/TestTime.cpp @@ -11,11 +11,11 @@ #include #include -#include #include #include "TestUtil.hpp" #include "ecflow/attribute/VerifyAttr.hpp" +#include "ecflow/core/Filesystem.hpp" #include "ecflow/node/Defs.hpp" #include "ecflow/node/Family.hpp" #include "ecflow/node/Suite.hpp" @@ -27,8 +27,6 @@ using namespace ecf; using namespace boost::gregorian; using namespace boost::posix_time; -namespace fs = boost::filesystem; - /// Simulate definition files that are created on then fly. This allows us to create /// tests with todays date/time this speeds up the testr, we can also validate /// Defs file, to check for correctness diff --git a/CSim/test/TestToday.cpp b/CSim/test/TestToday.cpp index 65b77a383..6d06172e4 100644 --- a/CSim/test/TestToday.cpp +++ b/CSim/test/TestToday.cpp @@ -11,11 +11,11 @@ #include #include -#include #include #include "TestUtil.hpp" #include "ecflow/attribute/VerifyAttr.hpp" +#include "ecflow/core/Filesystem.hpp" #include "ecflow/node/Defs.hpp" #include "ecflow/node/Family.hpp" #include "ecflow/node/Suite.hpp" @@ -27,8 +27,6 @@ using namespace ecf; using namespace boost::gregorian; using namespace boost::posix_time; -namespace fs = boost::filesystem; - /// Simulate definition files that are created on then fly. This allows us to create /// tests with todays date/time this speeds up the testr, we can also validate /// Defs file, to check for correctness diff --git a/CSim/test/TestUtil.hpp b/CSim/test/TestUtil.hpp index ad3e893b4..17ad0b3e7 100644 --- a/CSim/test/TestUtil.hpp +++ b/CSim/test/TestUtil.hpp @@ -13,14 +13,19 @@ #include -#include - // This class provides a test harness for running defs file in a client server environment // To avoid Address in use errors, we can have client/server use a different port number // This is more important when doing instrumentation in HP-UX, as that can take a long time. // -class TestUtil : private boost::noncopyable { +class TestUtil { public: + TestUtil() = delete; + TestUtil(const TestUtil&) = delete; + TestUtil(TestUtil&&) = delete; + + TestUtil& operator=(const TestUtil&) = delete; + TestUtil& operator=(TestUtil&&) = delete; + /// Returns the location of the defs file, such thats it in the test data area static std::string testDataLocation(const std::string& defsFile); }; diff --git a/Client/src/ecflow/client/ClientEnvironment.cpp b/Client/src/ecflow/client/ClientEnvironment.cpp index 3951d69e5..0511895bd 100644 --- a/Client/src/ecflow/client/ClientEnvironment.cpp +++ b/Client/src/ecflow/client/ClientEnvironment.cpp @@ -15,8 +15,6 @@ #include #include -#include - #include "ecflow/core/Converter.hpp" #include "ecflow/core/Ecf.hpp" #include "ecflow/core/File.hpp" @@ -29,7 +27,6 @@ #include "ecflow/base/Openssl.hpp" #endif -namespace fs = boost::filesystem; using namespace ecf; using namespace std; using namespace boost; diff --git a/Client/src/ecflow/client/UrlCmd.hpp b/Client/src/ecflow/client/UrlCmd.hpp index a6549dcf3..7dec8cf1a 100644 --- a/Client/src/ecflow/client/UrlCmd.hpp +++ b/Client/src/ecflow/client/UrlCmd.hpp @@ -13,8 +13,6 @@ #include -#include - #include "ecflow/node/NodeFwd.hpp" /// @@ -22,11 +20,18 @@ /// \note Placed in this category, since the server does not need to link with it. /// -class UrlCmd : private boost::noncopyable { +class UrlCmd { public: + UrlCmd() = delete; + UrlCmd(const UrlCmd&) = delete; + UrlCmd(UrlCmd&&) = delete; + /// Will throw std::runtime_error if defs or node path is not correct UrlCmd(defs_ptr defs, const std::string& absNodePath); + UrlCmd& operator=(const UrlCmd&) = delete; + UrlCmd& operator=(UrlCmd&&) = delete; + /// Will throw std::runtime_error if url cannot be formed std::string getUrl() const; diff --git a/Client/test/InvokeServer.hpp b/Client/test/InvokeServer.hpp index e48d25313..8aab48350 100644 --- a/Client/test/InvokeServer.hpp +++ b/Client/test/InvokeServer.hpp @@ -13,8 +13,6 @@ #include -#include -#include #include #include "TestHelper.hpp" @@ -23,8 +21,10 @@ #include "ecflow/core/Host.hpp" #include "ecflow/core/Str.hpp" -class InvokeServer : private boost::noncopyable { +class InvokeServer { public: + InvokeServer() = delete; + InvokeServer(const InvokeServer&) = delete; explicit InvokeServer(const std::string& msg, const std::string& port = ecf::Str::DEFAULT_PORT_NUMBER(), bool disable_job_generation = false, @@ -88,6 +88,8 @@ class InvokeServer : private boost::noncopyable { } } + InvokeServer& operator=(const InvokeServer&) = delete; + const std::string& port() const { return port_; } const std::string& host() const { if (host_.empty()) @@ -110,16 +112,16 @@ class InvokeServer : private boost::noncopyable { /// Remove check pt and backup check pt file, else server will load it & remove log file ecf::Host h; if (remove_checkpt_file_before_server_start) { - boost::filesystem::remove(h.ecf_checkpt_file(port)); - boost::filesystem::remove(h.ecf_backup_checkpt_file(port)); + fs::remove(h.ecf_checkpt_file(port)); + fs::remove(h.ecf_backup_checkpt_file(port)); } - boost::filesystem::remove(h.ecf_log_file(port)); + fs::remove(h.ecf_log_file(port)); // start the server in the background std::string theServerInvokePath = ecf::File::find_ecf_server_path(); BOOST_REQUIRE_MESSAGE(!theServerInvokePath.empty(), "InvokeServer::doStart: The server program could not be found"); - BOOST_REQUIRE_MESSAGE(boost::filesystem::exists(theServerInvokePath), + BOOST_REQUIRE_MESSAGE(fs::exists(theServerInvokePath), "InvokeServer::doStart: server exe does not exist at:" << theServerInvokePath); // Create a port file. To avoid creating multiple servers on the same port number @@ -165,23 +167,22 @@ class InvokeServer : private boost::noncopyable { // Remove generated file comment for debug ecf::Host h; if (remove_log_file_after_server_exit) { - boost::filesystem::remove(h.ecf_log_file(port)); - BOOST_CHECK_MESSAGE(!boost::filesystem::exists(h.ecf_log_file(port)), + fs::remove(h.ecf_log_file(port)); + BOOST_CHECK_MESSAGE(!fs::exists(h.ecf_log_file(port)), "log file " << h.ecf_log_file(port) << " not deleted\n"); } if (remove_checkpt_file_after_server_exit) { - boost::filesystem::remove(h.ecf_checkpt_file(port)); - boost::filesystem::remove(h.ecf_backup_checkpt_file(port)); - BOOST_CHECK_MESSAGE(!boost::filesystem::exists(h.ecf_checkpt_file(port)), + fs::remove(h.ecf_checkpt_file(port)); + fs::remove(h.ecf_backup_checkpt_file(port)); + BOOST_CHECK_MESSAGE(!fs::exists(h.ecf_checkpt_file(port)), "file " << h.ecf_checkpt_file(port) << " not deleted\n"); - BOOST_CHECK_MESSAGE(!boost::filesystem::exists(h.ecf_backup_checkpt_file(port)), + BOOST_CHECK_MESSAGE(!fs::exists(h.ecf_backup_checkpt_file(port)), "file " << h.ecf_backup_checkpt_file(port) << " not deleted\n"); } } private: - InvokeServer(const InvokeServer&) = delete; std::string port_; std::string host_; ecf::Host host_name_; diff --git a/Client/test/TestCheckPtDefsCmd.cpp b/Client/test/TestCheckPtDefsCmd.cpp index 134637a3b..84150c8ba 100644 --- a/Client/test/TestCheckPtDefsCmd.cpp +++ b/Client/test/TestCheckPtDefsCmd.cpp @@ -10,7 +10,6 @@ #include -#include #include #include "InvokeServer.hpp" @@ -21,7 +20,6 @@ #include "ecflow/core/File.hpp" #include "ecflow/core/Str.hpp" -namespace fs = boost::filesystem; using namespace std; using namespace ecf; diff --git a/Client/test/TestClientEnvironment.cpp b/Client/test/TestClientEnvironment.cpp index ceefbfed9..4a874f203 100644 --- a/Client/test/TestClientEnvironment.cpp +++ b/Client/test/TestClientEnvironment.cpp @@ -12,14 +12,12 @@ #include #include -#include #include #include "ecflow/client/ClientEnvironment.hpp" #include "ecflow/core/File.hpp" #include "ecflow/core/Str.hpp" -namespace fs = boost::filesystem; using namespace std; using namespace ecf; diff --git a/Client/test/TestClientInterface.cpp b/Client/test/TestClientInterface.cpp index fcf64b57b..5904575be 100644 --- a/Client/test/TestClientInterface.cpp +++ b/Client/test/TestClientInterface.cpp @@ -13,7 +13,6 @@ #include #include -#include #include #include "ecflow/base/cts/ClientToServerCmd.hpp" @@ -26,7 +25,6 @@ #include "ecflow/node/Submittable.hpp" #include "ecflow/node/Suite.hpp" -namespace fs = boost::filesystem; using namespace std; using namespace ecf; diff --git a/Client/test/TestClientTimeout.cpp b/Client/test/TestClientTimeout.cpp index a7bcaa0cc..e0b992239 100644 --- a/Client/test/TestClientTimeout.cpp +++ b/Client/test/TestClientTimeout.cpp @@ -12,8 +12,6 @@ // #include // #include // -// #include -// #include // #include // // #include "ecflow/client/ClientInvoker.hpp" @@ -22,7 +20,6 @@ // #include "SCPort.hpp" // #include "ecflow/core/Str.hpp" // -// namespace fs = boost::filesystem; // using namespace std; // using namespace ecf; // diff --git a/Client/test/TestCustomUser.cpp b/Client/test/TestCustomUser.cpp index 28a7bfc72..403b38112 100644 --- a/Client/test/TestCustomUser.cpp +++ b/Client/test/TestCustomUser.cpp @@ -8,7 +8,6 @@ * nor does it submit to any jurisdiction. */ -#include #include #include "InvokeServer.hpp" @@ -18,7 +17,6 @@ #include "ecflow/core/PasswdFile.hpp" #include "ecflow/core/User.hpp" -namespace fs = boost::filesystem; using namespace std; using namespace ecf; diff --git a/Client/test/TestJobGenOnly.cpp b/Client/test/TestJobGenOnly.cpp index c0866aaa6..01e1b4dc9 100644 --- a/Client/test/TestJobGenOnly.cpp +++ b/Client/test/TestJobGenOnly.cpp @@ -10,7 +10,6 @@ #include -#include #include // IWYU pragma: keep #include "ecflow/core/File.hpp" @@ -20,7 +19,6 @@ using namespace std; using namespace ecf; -namespace fs = boost::filesystem; BOOST_AUTO_TEST_SUITE(ClientTestSuite) diff --git a/Client/test/TestLogAndCheckptErrors.cpp b/Client/test/TestLogAndCheckptErrors.cpp index f43a4771e..fc5829c8e 100644 --- a/Client/test/TestLogAndCheckptErrors.cpp +++ b/Client/test/TestLogAndCheckptErrors.cpp @@ -10,8 +10,6 @@ #include -#include -#include #include #include @@ -24,7 +22,6 @@ #include "ecflow/core/PrintStyle.hpp" #include "ecflow/core/User.hpp" -namespace fs = boost::filesystem; using namespace std; using namespace ecf; @@ -58,7 +55,7 @@ BOOST_AUTO_TEST_CASE(test_log_and_checkpt_write_errors) { BOOST_CHECK_MESSAGE(chdir(ecf_home.c_str()) == 0, "Can't change directory to " << ecf_home << " error: " << strerror(errno)); if (debug_me) - cout << "->current path = " << boost::filesystem::current_path() << "\n"; + cout << "->current path = " << fs::current_path() << "\n"; { if (debug_me) @@ -159,7 +156,7 @@ BOOST_AUTO_TEST_CASE(test_log_and_checkpt_write_errors) { if (debug_me) cout << "->remove created directory " << ecf_home << "\n"; if (debug_me) - cout << "->current path = " << boost::filesystem::current_path() << "\n"; + cout << "->current path = " << fs::current_path() << "\n"; if (!debug_me) { BOOST_CHECK_MESSAGE(File::removeDir(ecf_home), "Failed to remove dir " << ecf_home << " error: " << strerror(errno)); diff --git a/Client/test/TestMigration.cpp b/Client/test/TestMigration.cpp index 5aa21074b..fe7dba0f8 100644 --- a/Client/test/TestMigration.cpp +++ b/Client/test/TestMigration.cpp @@ -10,8 +10,6 @@ #include -#include -#include #include #include "InvokeServer.hpp" @@ -27,7 +25,6 @@ #include "ecflow/node/Suite.hpp" #include "ecflow/node/Task.hpp" -namespace fs = boost::filesystem; using namespace std; using namespace ecf; @@ -55,8 +52,7 @@ void do_test_migration(ClientInvoker& theClient, const std::string& port, const std::string& directory, int& error_cnt) { - fs::path full_path(fs::initial_path()); - full_path = fs::system_complete(fs::path(directory)); + auto full_path = fs::absolute(directory); BOOST_CHECK(fs::exists(full_path)); BOOST_CHECK(fs::is_directory(full_path)); diff --git a/Client/test/TestPasswdFile.cpp b/Client/test/TestPasswdFile.cpp index 76a3b3755..f257f2536 100644 --- a/Client/test/TestPasswdFile.cpp +++ b/Client/test/TestPasswdFile.cpp @@ -8,7 +8,6 @@ * nor does it submit to any jurisdiction. */ -#include #include #include "InvokeServer.hpp" @@ -17,7 +16,6 @@ #include "ecflow/client/ClientInvoker.hpp" #include "ecflow/core/PasswdFile.hpp" -namespace fs = boost::filesystem; using namespace std; using namespace ecf; diff --git a/Client/test/TestRtt.cpp b/Client/test/TestRtt.cpp index 059495d70..5a583a725 100644 --- a/Client/test/TestRtt.cpp +++ b/Client/test/TestRtt.cpp @@ -10,13 +10,11 @@ #include -#include #include #include "ecflow/client/Rtt.hpp" #include "ecflow/core/File.hpp" -namespace fs = boost::filesystem; using namespace std; using namespace ecf; @@ -43,7 +41,7 @@ BOOST_AUTO_TEST_CASE(test_client_invoker_round_trip_times) { BOOST_CHECK_MESSAGE(diffs.empty(), diffs << "\n" << errorMsg); if (diffs.empty()) - boost::filesystem::remove(generated_file); + fs::remove(generated_file); } BOOST_AUTO_TEST_SUITE_END() diff --git a/Client/test/TestServerLoad.cpp b/Client/test/TestServerLoad.cpp index 4ca392b62..8cb3f6723 100644 --- a/Client/test/TestServerLoad.cpp +++ b/Client/test/TestServerLoad.cpp @@ -10,7 +10,6 @@ #include -#include #include #include "InvokeServer.hpp" @@ -18,7 +17,6 @@ #include "ecflow/client/ClientInvoker.hpp" #include "ecflow/core/File.hpp" -namespace fs = boost::filesystem; using namespace std; using namespace ecf; diff --git a/Client/test/TestSignalSIGTERM.cpp b/Client/test/TestSignalSIGTERM.cpp index 3556b1d74..416fdf34d 100644 --- a/Client/test/TestSignalSIGTERM.cpp +++ b/Client/test/TestSignalSIGTERM.cpp @@ -11,7 +11,6 @@ #include #include -#include #include #include "InvokeServer.hpp" @@ -19,7 +18,6 @@ #include "ecflow/client/ClientEnvironment.hpp" #include "ecflow/client/ClientInvoker.hpp" -namespace fs = boost::filesystem; using namespace std; using namespace ecf; diff --git a/Client/test/TestSinglePerf.cpp b/Client/test/TestSinglePerf.cpp index 1ef257904..7667b3d9c 100644 --- a/Client/test/TestSinglePerf.cpp +++ b/Client/test/TestSinglePerf.cpp @@ -11,8 +11,6 @@ #include // getenv #include -#include -#include #include #include "InvokeServer.hpp" @@ -29,7 +27,6 @@ #include "ecflow/node/Suite.hpp" #include "ecflow/node/Task.hpp" -namespace fs = boost::filesystem; using namespace std; using namespace ecf; @@ -69,8 +66,7 @@ void time_load_and_downloads(ClientInvoker& theClient, const std::string& host, const std::string& port, const std::string& directory) { - fs::path full_path(fs::initial_path()); - full_path = fs::system_complete(fs::path(directory)); + auto full_path = fs::absolute(directory); BOOST_CHECK(fs::exists(full_path)); BOOST_CHECK(fs::is_directory(full_path)); diff --git a/Client/test/TestWhiteListFile.cpp b/Client/test/TestWhiteListFile.cpp index ca47a657c..8c258884e 100644 --- a/Client/test/TestWhiteListFile.cpp +++ b/Client/test/TestWhiteListFile.cpp @@ -10,7 +10,6 @@ #include -#include #include #include "InvokeServer.hpp" @@ -19,7 +18,6 @@ #include "ecflow/client/ClientInvoker.hpp" #include "ecflow/core/WhiteListFile.hpp" -namespace fs = boost::filesystem; using namespace std; using namespace ecf; diff --git a/Http/src/ecflow/http/HttpServer.cpp b/Http/src/ecflow/http/HttpServer.cpp index 0b98ee34f..f1653b969 100644 --- a/Http/src/ecflow/http/HttpServer.cpp +++ b/Http/src/ecflow/http/HttpServer.cpp @@ -10,10 +10,10 @@ #include "ecflow/http/HttpServer.hpp" -#include #include #include "ecflow/core/Converter.hpp" +#include "ecflow/core/Filesystem.hpp" #include "ecflow/http/ApiV1.hpp" #include "ecflow/http/JSON.hpp" #include "ecflow/http/Options.hpp" @@ -207,8 +207,6 @@ void start_server(httplib::Server& http_server) { void HttpServer::run() { #ifdef ECF_OPENSSL if (opts.no_ssl == false) { - namespace fs = boost::filesystem; - if (fs::exists(opts.cert_directory + "/server.crt") == false || fs::exists(opts.cert_directory + "/server.key") == false) { throw std::runtime_error("Directory " + opts.cert_directory + diff --git a/Http/src/ecflow/http/TokenStorage.cpp b/Http/src/ecflow/http/TokenStorage.cpp index 9e283050e..7f84b430a 100644 --- a/Http/src/ecflow/http/TokenStorage.cpp +++ b/Http/src/ecflow/http/TokenStorage.cpp @@ -18,12 +18,12 @@ #include #include - #include #include #include #include #include + #include "ecflow/core/Filesystem.hpp" #include "ecflow/core/Str.hpp" #include "ecflow/http/HttpServerException.hpp" #include "ecflow/http/JSON.hpp" @@ -204,18 +204,16 @@ std::vector ReadTokens(const std::string& filename) { } void TokenStorage::ReadStorage() { - namespace fs = boost::filesystem; - namespace ch = std::chrono; - - const ch::seconds sleep_time(20); - ch::system_clock::time_point last_modified; + const std::chrono::seconds sleep_time(20); + std::chrono::system_clock::time_point last_modified; // Scan periodically the api-token file and read the // contents automatically if they are updated while (true) { try { - auto current_modified = ch::system_clock::from_time_t(fs::last_write_time(fs::path(opts.tokens_file))); + auto current_modified = + std::chrono::system_clock::from_time_t(fs::last_write_time(fs::path(opts.tokens_file))); if (current_modified > last_modified) { auto new_tokens = ReadTokens(opts.tokens_file); { diff --git a/Http/test/InvokeServer.hpp b/Http/test/InvokeServer.hpp index 13f035075..c5e3a683d 100644 --- a/Http/test/InvokeServer.hpp +++ b/Http/test/InvokeServer.hpp @@ -14,7 +14,6 @@ #include #include -#include #include #include "TestHelper.hpp" @@ -31,15 +30,14 @@ class InvokeServer { std::string port(getenv("ECF_PORT")); /// Remove check pt and backup check pt file, else server will load it & remove log file ecf::Host h; - boost::filesystem::remove(h.ecf_checkpt_file(port)); - boost::filesystem::remove(h.ecf_backup_checkpt_file(port)); - boost::filesystem::remove(h.ecf_log_file(port)); + fs::remove(h.ecf_checkpt_file(port)); + fs::remove(h.ecf_backup_checkpt_file(port)); + fs::remove(h.ecf_log_file(port)); std::string theServerInvokePath = ecf::File::find_ecf_server_path(); BOOST_REQUIRE_MESSAGE(!theServerInvokePath.empty(), "The server program could not be found"); - BOOST_REQUIRE_MESSAGE(boost::filesystem::exists(theServerInvokePath), - "Server exe does not exist at:" << theServerInvokePath); + BOOST_REQUIRE_MESSAGE(fs::exists(theServerInvokePath), "Server exe does not exist at:" << theServerInvokePath); BOOST_TEST_MESSAGE("Using eclow_server from " << theServerInvokePath); @@ -70,15 +68,14 @@ class InvokeServer { } ecf::Host h; - boost::filesystem::remove(h.ecf_log_file(port)); - BOOST_CHECK_MESSAGE(!boost::filesystem::exists(h.ecf_log_file(port)), - "log file " << h.ecf_log_file(port) << " not deleted\n"); + fs::remove(h.ecf_log_file(port)); + BOOST_CHECK_MESSAGE(!fs::exists(h.ecf_log_file(port)), "log file " << h.ecf_log_file(port) << " not deleted\n"); - boost::filesystem::remove(h.ecf_checkpt_file(port)); - boost::filesystem::remove(h.ecf_backup_checkpt_file(port)); - BOOST_CHECK_MESSAGE(!boost::filesystem::exists(h.ecf_checkpt_file(port)), + fs::remove(h.ecf_checkpt_file(port)); + fs::remove(h.ecf_backup_checkpt_file(port)); + BOOST_CHECK_MESSAGE(!fs::exists(h.ecf_checkpt_file(port)), "file " << h.ecf_checkpt_file(port) << " not deleted\n"); - BOOST_CHECK_MESSAGE(!boost::filesystem::exists(h.ecf_backup_checkpt_file(port)), + BOOST_CHECK_MESSAGE(!fs::exists(h.ecf_backup_checkpt_file(port)), "file " << h.ecf_backup_checkpt_file(port) << " not deleted\n"); } diff --git a/Http/test/TestApiV1.cpp b/Http/test/TestApiV1.cpp index 61c5a4b5f..faf69bf3e 100644 --- a/Http/test/TestApiV1.cpp +++ b/Http/test/TestApiV1.cpp @@ -20,7 +20,6 @@ #include "ecflow/http/HttpServer.hpp" #include "ecflow/http/HttpServerException.hpp" #include "httplib.h" -#include "nlohmann/json.hpp" BOOST_AUTO_TEST_SUITE(HttpTestSuite) @@ -36,8 +35,6 @@ std::unique_ptr create_certificate() { const std::string path_to_cert = (cert_dir == nullptr) ? std::string(getenv("HOME")) + "/.ecflowrc/ssl/" : std::string(cert_dir); - namespace fs = boost::filesystem; - std::unique_ptr cert; BOOST_TEST_MESSAGE("Certificates at " << path_to_cert); @@ -56,8 +53,6 @@ std::unique_ptr create_certificate() { } std::unique_ptr create_token_file() { - namespace fs = boost::filesystem; - fs::path cwd(fs::current_path()); string tokens_file = cwd.string() + "/api-tokens.json"; diff --git a/Pyext/src/ecflow/python/BoostPythonUtil.hpp b/Pyext/src/ecflow/python/BoostPythonUtil.hpp index 98fa677dd..44f57ad76 100644 --- a/Pyext/src/ecflow/python/BoostPythonUtil.hpp +++ b/Pyext/src/ecflow/python/BoostPythonUtil.hpp @@ -13,15 +13,18 @@ #include -#include #include // IWYU pragma: keep class Variable; // See: http://wiki.python.org/moin/boost.python/HowTo#boost.function_objects -class BoostPythonUtil : private boost::noncopyable { +class BoostPythonUtil { public: + BoostPythonUtil() = delete; + BoostPythonUtil(const BoostPythonUtil&) = delete; + BoostPythonUtil& operator=(const BoostPythonUtil&) = delete; + /// Convert python list to a vector of integers. raises a type error if integer extraction fails static void list_to_int_vec(const boost::python::list& list, std::vector& int_vec); static void list_to_str_vec(const boost::python::list& list, std::vector& int_vec); diff --git a/Pyext/src/ecflow/python/ClientDoc.hpp b/Pyext/src/ecflow/python/ClientDoc.hpp index 8540be1c5..ab6487b4e 100644 --- a/Pyext/src/ecflow/python/ClientDoc.hpp +++ b/Pyext/src/ecflow/python/ClientDoc.hpp @@ -11,15 +11,17 @@ #ifndef ecflow_python_ClientDoc_HPP #define ecflow_python_ClientDoc_HPP -#include - // =========================================================================== // IMPORTANT: These appear as python doc strings. // Additionally they are auto documented using sphinx-poco // Hence the doc strings use reStructuredText markup. // =========================================================================== -class ClientDoc : private boost::noncopyable { +class ClientDoc { public: + ClientDoc() = delete; + ClientDoc(const ClientDoc&) = delete; + ClientDoc& operator=(const ClientDoc&) = delete; + static const char* class_client(); static const char* set_host_port(); static const char* set_retry_connection_period(); @@ -94,9 +96,6 @@ class ClientDoc : private boost::noncopyable { static const char* set_child_timeout(); static const char* set_child_init_add_vars(); static const char* set_child_complete_del_vars(); - -private: - ClientDoc() = default; }; #endif /* ecflow_python_ClientDoc_HPP */ diff --git a/Pyext/src/ecflow/python/DefsDoc.hpp b/Pyext/src/ecflow/python/DefsDoc.hpp index e43c7d73a..901bbf552 100644 --- a/Pyext/src/ecflow/python/DefsDoc.hpp +++ b/Pyext/src/ecflow/python/DefsDoc.hpp @@ -18,8 +18,12 @@ // Additionally they are auto documented using sphinx-poco // Hence the doc strings use reStructuredText markup. // =========================================================================== -class DefsDoc : private boost::noncopyable { +class DefsDoc { public: + DefsDoc() = delete; + DefsDoc(const DefsDoc&) = delete; + DefsDoc& operator=(const DefsDoc&) = delete; + static const char* add(); static const char* abs_node_path_doc(); static const char* part_expression_doc(); @@ -67,9 +71,6 @@ class DefsDoc : private boost::noncopyable { static const char* check(); static const char* simulate(); static const char* get_server_state(); - -private: - DefsDoc() = default; }; #endif /* ecflow_python_DefsDoc_HPP */ diff --git a/Pyext/src/ecflow/python/ExportClient.cpp b/Pyext/src/ecflow/python/ExportClient.cpp index 1d1562851..3bbfa0860 100644 --- a/Pyext/src/ecflow/python/ExportClient.cpp +++ b/Pyext/src/ecflow/python/ExportClient.cpp @@ -10,7 +10,6 @@ #include // for std::transform -#include #include #include "ecflow/base/WhyCmd.hpp" diff --git a/Pyext/src/ecflow/python/ExportCore.cpp b/Pyext/src/ecflow/python/ExportCore.cpp index c229b9efc..c0fff4173 100644 --- a/Pyext/src/ecflow/python/ExportCore.cpp +++ b/Pyext/src/ecflow/python/ExportCore.cpp @@ -8,7 +8,6 @@ * nor does it submit to any jurisdiction. */ -#include #include #include diff --git a/Pyext/src/ecflow/python/ExportNode.cpp b/Pyext/src/ecflow/python/ExportNode.cpp index 7250be4e5..7d7dea21c 100644 --- a/Pyext/src/ecflow/python/ExportNode.cpp +++ b/Pyext/src/ecflow/python/ExportNode.cpp @@ -10,7 +10,6 @@ #include -#include #include #include #include diff --git a/Pyext/src/ecflow/python/ExportNodeAttr.cpp b/Pyext/src/ecflow/python/ExportNodeAttr.cpp index a501c72a2..d30eaf332 100644 --- a/Pyext/src/ecflow/python/ExportNodeAttr.cpp +++ b/Pyext/src/ecflow/python/ExportNodeAttr.cpp @@ -10,7 +10,6 @@ #include -#include #include #include #include diff --git a/Pyext/src/ecflow/python/ExportSuiteAndFamily.cpp b/Pyext/src/ecflow/python/ExportSuiteAndFamily.cpp index bcfcb6368..c2682142d 100644 --- a/Pyext/src/ecflow/python/ExportSuiteAndFamily.cpp +++ b/Pyext/src/ecflow/python/ExportSuiteAndFamily.cpp @@ -8,7 +8,6 @@ * nor does it submit to any jurisdiction. */ -#include #include #include #include diff --git a/Pyext/src/ecflow/python/ExportTask.cpp b/Pyext/src/ecflow/python/ExportTask.cpp index b7db346f9..fe1c50815 100644 --- a/Pyext/src/ecflow/python/ExportTask.cpp +++ b/Pyext/src/ecflow/python/ExportTask.cpp @@ -8,7 +8,6 @@ * nor does it submit to any jurisdiction. */ -#include #include #include #include diff --git a/Pyext/src/ecflow/python/GlossaryDoc.hpp b/Pyext/src/ecflow/python/GlossaryDoc.hpp index 0ad8fa5ab..9dbc69808 100644 --- a/Pyext/src/ecflow/python/GlossaryDoc.hpp +++ b/Pyext/src/ecflow/python/GlossaryDoc.hpp @@ -18,12 +18,13 @@ // Additionally they are auto documented using sphinx-poco // Hence the doc strings use reStructuredText markup. // =========================================================================== -class GlossaryDoc : private boost::noncopyable { +class GlossaryDoc { public: - static const char* list(); + GlossaryDoc() = delete; + GlossaryDoc(const GlossaryDoc&) = delete; + GlossaryDoc& operator=(const GlossaryDoc&) = delete; -private: - GlossaryDoc() = default; + static const char* list(); }; #endif /* ecflow_python_GlossaryDoc_HPP */ diff --git a/Pyext/src/ecflow/python/NodeAttrDoc.hpp b/Pyext/src/ecflow/python/NodeAttrDoc.hpp index 5193e7368..f6121d5dc 100644 --- a/Pyext/src/ecflow/python/NodeAttrDoc.hpp +++ b/Pyext/src/ecflow/python/NodeAttrDoc.hpp @@ -18,8 +18,12 @@ // Additionally they are auto documented using sphinx-poco // Hence the doc strings use reStructuredText markup // =========================================================================== -class NodeAttrDoc : private boost::noncopyable { +class NodeAttrDoc { public: + NodeAttrDoc() = delete; + NodeAttrDoc(const NodeAttrDoc&) = delete; + NodeAttrDoc& operator=(const NodeAttrDoc&) = delete; + static const char* variable_doc(); static const char* zombie_doc(); static const char* zombie_type_doc(); @@ -49,9 +53,6 @@ class NodeAttrDoc : private boost::noncopyable { static const char* repeat_day_doc(); static const char* cron_doc(); static const char* clock_doc(); - -private: - NodeAttrDoc() = default; }; #endif /* ecflow_python_NodeAttrDoc_HPP */ diff --git a/Pyext/src/ecflow/python/NodeUtil.hpp b/Pyext/src/ecflow/python/NodeUtil.hpp index fdde0bf91..01f02d7f4 100644 --- a/Pyext/src/ecflow/python/NodeUtil.hpp +++ b/Pyext/src/ecflow/python/NodeUtil.hpp @@ -11,13 +11,16 @@ #ifndef ecflow_python_NodeUtil_HPP #define ecflow_python_NodeUtil_HPP -#include #include #include "ecflow/node/NodeFwd.hpp" -class NodeUtil : private boost::noncopyable { +class NodeUtil { public: + NodeUtil() = delete; + NodeUtil(const NodeUtil&) = delete; + NodeUtil& operator=(const NodeUtil&) = delete; + /// any nodes and attributes to be added static boost::python::object do_add(node_ptr self, const boost::python::object& arg); diff --git a/Pyext/test/TestEmbeddedEcf.cpp b/Pyext/test/TestEmbeddedEcf.cpp index 32443431b..2af47c516 100644 --- a/Pyext/test/TestEmbeddedEcf.cpp +++ b/Pyext/test/TestEmbeddedEcf.cpp @@ -15,12 +15,8 @@ #include // #include // #include -// #include -// #include // #include // -// namespace fs = boost::filesystem; -// namespace python = boost::python; // //// init_defs is defined in BOOST_PYTHON_MODULE(_defs) in file EcfDefsExt.cpp //// However we need definition here. Hence expanded the pertinent contents of diff --git a/Server/src/ecflow/server/BaseServer.cpp b/Server/src/ecflow/server/BaseServer.cpp index a9eb30258..c1801ac92 100644 --- a/Server/src/ecflow/server/BaseServer.cpp +++ b/Server/src/ecflow/server/BaseServer.cpp @@ -14,10 +14,10 @@ #include #include -#include #include "ecflow/core/Calendar.hpp" #include "ecflow/core/Ecf.hpp" +#include "ecflow/core/Filesystem.hpp" #include "ecflow/core/Log.hpp" #include "ecflow/core/Version.hpp" #include "ecflow/node/Defs.hpp" @@ -26,7 +26,6 @@ #include "ecflow/server/ServerEnvironment.hpp" using boost::asio::ip::tcp; -namespace fs = boost::filesystem; using namespace std; using namespace ecf; diff --git a/Server/src/ecflow/server/CheckPtSaver.cpp b/Server/src/ecflow/server/CheckPtSaver.cpp index ab04f339a..aac3dd824 100644 --- a/Server/src/ecflow/server/CheckPtSaver.cpp +++ b/Server/src/ecflow/server/CheckPtSaver.cpp @@ -10,12 +10,10 @@ #include "ecflow/server/CheckPtSaver.hpp" -#include -#include - #include "ecflow/base/cts/CtsApi.hpp" #include "ecflow/core/DurationTimer.hpp" #include "ecflow/core/Ecf.hpp" +#include "ecflow/core/Filesystem.hpp" #include "ecflow/core/Log.hpp" #include "ecflow/core/Str.hpp" #include "ecflow/node/Defs.hpp" @@ -29,7 +27,6 @@ #include // requires boost date and time lib, for to_simple_string #endif -namespace fs = boost::filesystem; using namespace ecf; //------------------------------------------------------------------------------------- diff --git a/Server/src/ecflow/server/CheckPtSaver.hpp b/Server/src/ecflow/server/CheckPtSaver.hpp index c3f6ab20d..7783d83f2 100644 --- a/Server/src/ecflow/server/CheckPtSaver.hpp +++ b/Server/src/ecflow/server/CheckPtSaver.hpp @@ -12,9 +12,8 @@ #define ecflow_server_CheckPtSaver_HPP #include -#include -namespace fs = boost::filesystem; +#include "ecflow/core/Filesystem.hpp" class ServerEnvironment; class BaseServer; diff --git a/Server/src/ecflow/server/ServerEnvironment.cpp b/Server/src/ecflow/server/ServerEnvironment.cpp index 0b5053f44..1e97b4ad7 100644 --- a/Server/src/ecflow/server/ServerEnvironment.cpp +++ b/Server/src/ecflow/server/ServerEnvironment.cpp @@ -13,13 +13,12 @@ #include // for getenv() #include -#include -#include #include #include "ecflow/core/Calendar.hpp" #include "ecflow/core/Converter.hpp" #include "ecflow/core/Ecf.hpp" +#include "ecflow/core/Filesystem.hpp" #include "ecflow/core/Log.hpp" #include "ecflow/core/Pid.hpp" #include "ecflow/core/Str.hpp" @@ -32,7 +31,6 @@ using namespace ecf; using namespace std; using namespace boost; namespace po = boost::program_options; -namespace fs = boost::filesystem; static std::string the_check_mode(ecf::CheckPt::Mode mode) { switch (mode) { diff --git a/Server/test/TestServer1.cpp b/Server/test/TestServer1.cpp index 9812674d7..c58e1e22e 100644 --- a/Server/test/TestServer1.cpp +++ b/Server/test/TestServer1.cpp @@ -11,7 +11,6 @@ #include #include -#include #include #include "ecflow/core/EcfPortLock.hpp" @@ -23,7 +22,6 @@ using namespace std; using namespace ecf; -namespace fs = boost::filesystem; BOOST_AUTO_TEST_SUITE(TestServer) diff --git a/Server/test/TestServerEnvironment.cpp b/Server/test/TestServerEnvironment.cpp index e419ca57d..4531ece04 100644 --- a/Server/test/TestServerEnvironment.cpp +++ b/Server/test/TestServerEnvironment.cpp @@ -12,7 +12,6 @@ #include #include -#include #include #include "ecflow/core/CheckPt.hpp" @@ -27,7 +26,6 @@ using namespace std; using namespace ecf; -namespace fs = boost::filesystem; BOOST_AUTO_TEST_SUITE(TestServer) diff --git a/Test/TestAbortCmd.cpp b/Test/TestAbortCmd.cpp index ae79db3c5..147fa0d51 100644 --- a/Test/TestAbortCmd.cpp +++ b/Test/TestAbortCmd.cpp @@ -12,8 +12,6 @@ #include #include -#include -#include #include #include "ServerTestHarness.hpp" @@ -27,7 +25,6 @@ using namespace std; using namespace ecf; -namespace fs = boost::filesystem; BOOST_AUTO_TEST_SUITE(TestSuite) diff --git a/Test/TestAlias.cpp b/Test/TestAlias.cpp index 124495544..a5bbb9a0c 100644 --- a/Test/TestAlias.cpp +++ b/Test/TestAlias.cpp @@ -12,8 +12,6 @@ #include // for std::numeric_limits::max() #include -#include -#include #include #include "ServerTestHarness.hpp" @@ -35,7 +33,6 @@ using namespace std; using namespace ecf; using namespace boost::gregorian; using namespace boost::posix_time; -namespace fs = boost::filesystem; /// /// This test will TEST: diff --git a/Test/TestClkSync.cpp b/Test/TestClkSync.cpp index 1c6410653..8a924661a 100644 --- a/Test/TestClkSync.cpp +++ b/Test/TestClkSync.cpp @@ -13,8 +13,6 @@ #include #include -#include -#include #include #include "ServerTestHarness.hpp" @@ -29,7 +27,6 @@ using namespace std; using namespace ecf; -namespace fs = boost::filesystem; using namespace boost::gregorian; using namespace boost::posix_time; diff --git a/Test/TestComplete.cpp b/Test/TestComplete.cpp index 82068ebe3..bb7c75765 100644 --- a/Test/TestComplete.cpp +++ b/Test/TestComplete.cpp @@ -12,8 +12,6 @@ #include #include -#include -#include #include #include "ServerTestHarness.hpp" @@ -26,7 +24,6 @@ using namespace std; using namespace ecf; -namespace fs = boost::filesystem; BOOST_AUTO_TEST_SUITE(TestSuite) diff --git a/Test/TestCron.cpp b/Test/TestCron.cpp index be410efb5..46b6d429b 100644 --- a/Test/TestCron.cpp +++ b/Test/TestCron.cpp @@ -13,8 +13,6 @@ #include #include -#include -#include #include #include "ServerTestHarness.hpp" diff --git a/Test/TestCtsWaitCmd.cpp b/Test/TestCtsWaitCmd.cpp index c44cfcc9e..763b6576e 100644 --- a/Test/TestCtsWaitCmd.cpp +++ b/Test/TestCtsWaitCmd.cpp @@ -12,8 +12,6 @@ #include #include -#include -#include #include #include "ServerTestHarness.hpp" @@ -28,7 +26,6 @@ using namespace std; using namespace ecf; -namespace fs = boost::filesystem; BOOST_AUTO_TEST_SUITE(TestSuite) diff --git a/Test/TestDayDate.cpp b/Test/TestDayDate.cpp index c65157c95..5eb6515a3 100644 --- a/Test/TestDayDate.cpp +++ b/Test/TestDayDate.cpp @@ -13,8 +13,6 @@ #include #include -#include -#include #include #include "ServerTestHarness.hpp" @@ -29,7 +27,6 @@ using namespace std; using namespace ecf; using namespace boost::gregorian; using namespace boost::posix_time; -namespace fs = boost::filesystem; BOOST_AUTO_TEST_SUITE(TestSuite) diff --git a/Test/TestEcfNoScriptCmd.cpp b/Test/TestEcfNoScriptCmd.cpp index 1d7136974..2a2dfb6ff 100644 --- a/Test/TestEcfNoScriptCmd.cpp +++ b/Test/TestEcfNoScriptCmd.cpp @@ -12,8 +12,6 @@ #include #include -#include -#include #include #include "ServerTestHarness.hpp" @@ -26,7 +24,6 @@ using namespace std; using namespace ecf; -namespace fs = boost::filesystem; BOOST_AUTO_TEST_SUITE(TestSuite) diff --git a/Test/TestEvents.cpp b/Test/TestEvents.cpp index 86c7b55bb..49085c61c 100644 --- a/Test/TestEvents.cpp +++ b/Test/TestEvents.cpp @@ -12,8 +12,6 @@ #include #include -#include -#include #include #include "ServerTestHarness.hpp" @@ -28,7 +26,6 @@ using namespace std; using namespace ecf; -namespace fs = boost::filesystem; BOOST_AUTO_TEST_SUITE(TestSuite) diff --git a/Test/TestFileCmd.cpp b/Test/TestFileCmd.cpp index d6d0fa6f0..6ceca905a 100644 --- a/Test/TestFileCmd.cpp +++ b/Test/TestFileCmd.cpp @@ -10,9 +10,6 @@ #include -#include -#include -#include #include #include "ServerTestHarness.hpp" @@ -31,7 +28,6 @@ using namespace std; using namespace ecf; using namespace boost::gregorian; using namespace boost::posix_time; -namespace fs = boost::filesystem; /// /// \note This is used to INVOKE a SINGLE test. Easier for debugging diff --git a/Test/TestHandle.cpp b/Test/TestHandle.cpp index 0472a595f..4ef765e52 100644 --- a/Test/TestHandle.cpp +++ b/Test/TestHandle.cpp @@ -12,8 +12,6 @@ #include // for std::numeric_limits::max() #include -#include -#include #include #include "ServerTestHarness.hpp" @@ -33,7 +31,6 @@ using namespace std; using namespace ecf; using namespace boost::gregorian; using namespace boost::posix_time; -namespace fs = boost::filesystem; /// /// \note This is used to INVOKE a SINGLE test. diff --git a/Test/TestKillCmd.cpp b/Test/TestKillCmd.cpp index cd5f20fe8..85ba5600d 100644 --- a/Test/TestKillCmd.cpp +++ b/Test/TestKillCmd.cpp @@ -10,9 +10,6 @@ #include -#include -#include -#include #include #include "ServerTestHarness.hpp" @@ -32,7 +29,6 @@ using namespace std; using namespace ecf; using namespace boost::gregorian; using namespace boost::posix_time; -namespace fs = boost::filesystem; /// /// \note This is used to INVOKE a SINGLE test. Easier for debugging diff --git a/Test/TestLate.cpp b/Test/TestLate.cpp index bd51c80d1..e26800b91 100644 --- a/Test/TestLate.cpp +++ b/Test/TestLate.cpp @@ -12,8 +12,6 @@ #include // for std::numeric_limits::max() #include -#include -#include #include #include "ServerTestHarness.hpp" @@ -33,7 +31,6 @@ using namespace std; using namespace ecf; using namespace boost::gregorian; using namespace boost::posix_time; -namespace fs = boost::filesystem; BOOST_AUTO_TEST_SUITE(TestSuite) diff --git a/Test/TestLimit.cpp b/Test/TestLimit.cpp index d14e54845..864266243 100644 --- a/Test/TestLimit.cpp +++ b/Test/TestLimit.cpp @@ -12,8 +12,6 @@ #include #include -#include -#include #include #include "ServerTestHarness.hpp" @@ -28,7 +26,6 @@ using namespace std; using namespace ecf; -namespace fs = boost::filesystem; BOOST_AUTO_TEST_SUITE(TestSuite) diff --git a/Test/TestOrderCmd.cpp b/Test/TestOrderCmd.cpp index 5e3592412..e37ca9168 100644 --- a/Test/TestOrderCmd.cpp +++ b/Test/TestOrderCmd.cpp @@ -12,8 +12,6 @@ #include // for std::numeric_limits::max() #include -#include -#include #include #include "ServerTestHarness.hpp" @@ -32,7 +30,6 @@ using namespace std; using namespace ecf; using namespace boost::gregorian; using namespace boost::posix_time; -namespace fs = boost::filesystem; /// /// \note This is used to INVOKE a SINGLE test. diff --git a/Test/TestQueueCmd.cpp b/Test/TestQueueCmd.cpp index 09cc00eb9..059c29429 100644 --- a/Test/TestQueueCmd.cpp +++ b/Test/TestQueueCmd.cpp @@ -12,8 +12,6 @@ #include #include -#include -#include #include #include "ServerTestHarness.hpp" @@ -27,7 +25,6 @@ using namespace std; using namespace ecf; -namespace fs = boost::filesystem; BOOST_AUTO_TEST_SUITE(TestSuite) diff --git a/Test/TestRepeat.cpp b/Test/TestRepeat.cpp index d1d035407..7370b7275 100644 --- a/Test/TestRepeat.cpp +++ b/Test/TestRepeat.cpp @@ -13,8 +13,6 @@ #include #include -#include -#include #include #include "ServerTestHarness.hpp" @@ -34,7 +32,6 @@ using namespace boost::gregorian; using namespace boost::posix_time; using namespace std; using namespace ecf; -namespace fs = boost::filesystem; BOOST_AUTO_TEST_SUITE(TestSuite) diff --git a/Test/TestServer.cpp b/Test/TestServer.cpp index 792b47202..086da65ba 100644 --- a/Test/TestServer.cpp +++ b/Test/TestServer.cpp @@ -12,8 +12,6 @@ #include #include -#include -#include #include #include "ServerTestHarness.hpp" @@ -21,8 +19,8 @@ #include "ecflow/attribute/VerifyAttr.hpp" #include "ecflow/core/Converter.hpp" #include "ecflow/core/DurationTimer.hpp" +#include "ecflow/core/Filesystem.hpp" #include "ecflow/core/Host.hpp" -#include "ecflow/core/Str.hpp" #include "ecflow/node/Defs.hpp" #include "ecflow/node/Family.hpp" #include "ecflow/node/Suite.hpp" @@ -30,7 +28,6 @@ using namespace std; using namespace ecf; -namespace fs = boost::filesystem; BOOST_AUTO_TEST_SUITE(TestSuite) diff --git a/Test/TestSingle.cpp b/Test/TestSingle.cpp index a50843066..2f94e48b4 100644 --- a/Test/TestSingle.cpp +++ b/Test/TestSingle.cpp @@ -11,10 +11,8 @@ #include #include // for std::numeric_limits::max() -#include -#include -#define BOOST_TEST_MODULE TEST_SINGLE #include +#define BOOST_TEST_MODULE TEST_SINGLE #include #include "ServerTestHarness.hpp" @@ -34,7 +32,6 @@ using namespace std; using namespace ecf; using namespace boost::gregorian; using namespace boost::posix_time; -namespace fs = boost::filesystem; BOOST_GLOBAL_FIXTURE(TestFixture); @@ -144,7 +141,7 @@ BOOST_AUTO_TEST_CASE(test_stress) { // cout << "Test:: ..." << path << " log file: " << log_file << flush; // // // Remove the log file. -// boost::filesystem::remove(log_file); +// fs::remove(log_file); // // // parse in file // Defs theDefs; diff --git a/Test/TestToday.cpp b/Test/TestToday.cpp index 1abfafccd..5890817e1 100644 --- a/Test/TestToday.cpp +++ b/Test/TestToday.cpp @@ -13,8 +13,6 @@ #include #include -#include -#include #include #include "ServerTestHarness.hpp" diff --git a/Test/TestTrigger.cpp b/Test/TestTrigger.cpp index be6d8cc84..0618993e5 100644 --- a/Test/TestTrigger.cpp +++ b/Test/TestTrigger.cpp @@ -12,8 +12,6 @@ #include #include -#include -#include #include #include "ServerTestHarness.hpp" @@ -29,7 +27,6 @@ using namespace std; using namespace ecf; -namespace fs = boost::filesystem; BOOST_AUTO_TEST_SUITE(TestSuite) diff --git a/Test/TestWhyCmd.cpp b/Test/TestWhyCmd.cpp index 99ab99c9a..24af600bc 100644 --- a/Test/TestWhyCmd.cpp +++ b/Test/TestWhyCmd.cpp @@ -11,8 +11,6 @@ #include #include -#include -#include #include #include "ServerTestHarness.hpp" @@ -34,7 +32,6 @@ using namespace std; using namespace ecf; using namespace boost::gregorian; using namespace boost::posix_time; -namespace fs = boost::filesystem; BOOST_AUTO_TEST_SUITE(TestSuite) diff --git a/Test/TestZombies.cpp b/Test/TestZombies.cpp index eb987ac5b..3fef5edbf 100644 --- a/Test/TestZombies.cpp +++ b/Test/TestZombies.cpp @@ -12,8 +12,6 @@ #include // for std::numeric_limits::max() #include -#include -#include #define BOOST_TEST_MODULE TEST_ZOMBIES #include @@ -34,7 +32,6 @@ using namespace std; using namespace ecf; using namespace boost::gregorian; using namespace boost::posix_time; -namespace fs = boost::filesystem; /// /// \note This is used to INVOKE a SINGLE test. diff --git a/Test/Test_ECF_SCRIPT_CMD.cpp b/Test/Test_ECF_SCRIPT_CMD.cpp index 26c312fe1..510d3d63b 100644 --- a/Test/Test_ECF_SCRIPT_CMD.cpp +++ b/Test/Test_ECF_SCRIPT_CMD.cpp @@ -12,8 +12,6 @@ #include #include -#include -#include #include #include "ServerTestHarness.hpp" @@ -28,7 +26,6 @@ using namespace std; using namespace ecf; -namespace fs = boost::filesystem; BOOST_AUTO_TEST_SUITE(TestSuite) diff --git a/Test/Test_Time.cpp b/Test/Test_Time.cpp index a0495b386..10a9c0425 100644 --- a/Test/Test_Time.cpp +++ b/Test/Test_Time.cpp @@ -13,8 +13,6 @@ #include #include -#include -#include #include #include "ServerTestHarness.hpp" diff --git a/Test/src/ServerTestHarness.cpp b/Test/src/ServerTestHarness.cpp index 980c31c1d..5d273a552 100644 --- a/Test/src/ServerTestHarness.cpp +++ b/Test/src/ServerTestHarness.cpp @@ -12,7 +12,6 @@ #include -#include #include #include "TestFixture.hpp" @@ -31,7 +30,6 @@ using namespace std; using namespace ecf; -namespace fs = boost::filesystem; // #define DEBUG_TEST_WAITER 1 // #define DEBUG_TEST_WAITER_DEFS 1 diff --git a/Test/src/TestFixture.cpp b/Test/src/TestFixture.cpp index 0d77455b1..48fb5cc75 100644 --- a/Test/src/TestFixture.cpp +++ b/Test/src/TestFixture.cpp @@ -14,15 +14,13 @@ #include // for ofstream #include -#include -#include - #include "TestHelper.hpp" #include "ecflow/base/cts/CtsApi.hpp" #include "ecflow/client/ClientEnvironment.hpp" // needed for static ClientEnvironment::hostSpecified(); ONLY #include "ecflow/client/Rtt.hpp" #include "ecflow/core/EcfPortLock.hpp" #include "ecflow/core/File.hpp" +#include "ecflow/core/Filesystem.hpp" #include "ecflow/core/Host.hpp" #include "ecflow/core/PrintStyle.hpp" #include "ecflow/core/Str.hpp" @@ -42,7 +40,6 @@ std::string TestFixture::project_test_dir_ = "Test"; using namespace std; using namespace ecf; -namespace fs = boost::filesystem; // ************************************************************************************************ // For test purpose the server can be started: @@ -88,7 +85,7 @@ void TestFixture::init(const std::string& project_test_dir) { } // client side file for recording all ClientInvoker round trip times - boost::filesystem::remove(rtt_filename); + fs::remove(rtt_filename); Rtt::create(rtt_filename); // ******************************************************** @@ -120,8 +117,8 @@ void TestFixture::init(const std::string& project_test_dir) { theSCRATCHArea += "/test_dir"; test_dir_ = theSCRATCHArea; // test_dir_ needed in destructor - if (boost::filesystem::exists(test_dir_)) { - boost::filesystem::remove_all(test_dir_); + if (fs::exists(test_dir_)) { + fs::remove_all(test_dir_); } theSCRATCHArea += "/ECF_HOME"; scratchSmsHome_ = theSCRATCHArea; @@ -174,7 +171,7 @@ void TestFixture::init(const std::string& project_test_dir) { } else { // For local host start by removing log file. Server invocation should create a new log file - boost::filesystem::remove(boost::filesystem::path(pathToLogFile())); + fs::remove(fs::path(pathToLogFile())); host_ = Str::LOCALHOST(); // Create a unique port number, allowing debug and release to run at the same time @@ -192,8 +189,8 @@ void TestFixture::init(const std::string& project_test_dir) { // Remove the generated check point files, at start of test, otherwise server will load check point file Host h; - boost::filesystem::remove(h.ecf_checkpt_file(port_)); - boost::filesystem::remove(h.ecf_backup_checkpt_file(port_)); + fs::remove(h.ecf_checkpt_file(port_)); + fs::remove(h.ecf_backup_checkpt_file(port_)); std::string theServerInvokePath = File::find_ecf_server_path(); assert(!theServerInvokePath.empty()); @@ -235,13 +232,13 @@ TestFixture::~TestFixture() { // destructors should not allow exception propagation try { #ifndef DEBUG_HOST_SERVER - if (!host_.empty() && boost::filesystem::exists(test_dir_)) { - boost::filesystem::remove_all(test_dir_); + if (!host_.empty() && fs::exists(test_dir_)) { + fs::remove_all(test_dir_); } #endif #ifndef DEBUG_LOCAL_SERVER - if (boost::filesystem::exists(local_ecf_home())) { - boost::filesystem::remove_all(local_ecf_home()); + if (fs::exists(local_ecf_home())) { + fs::remove_all(local_ecf_home()); } #endif @@ -270,9 +267,9 @@ TestFixture::~TestFixture() { std::cout << " Remove the generated check point files, at end of test\n"; Host host; - boost::filesystem::remove(host.ecf_log_file(port_)); - boost::filesystem::remove(host.ecf_checkpt_file(port_)); - boost::filesystem::remove(host.ecf_backup_checkpt_file(port_)); + fs::remove(host.ecf_log_file(port_)); + fs::remove(host.ecf_checkpt_file(port_)); + fs::remove(host.ecf_backup_checkpt_file(port_)); std::cout << " remove the lock file\n"; EcfPortLock::remove(port_); @@ -283,7 +280,7 @@ TestFixture::~TestFixture() { cout << "\nTiming: *NOTE*: The child commands *NOT* recorded. Since its a separate exe(ecflow_client), called " "via .ecf script\n"; cout << Rtt::analyis(rtt_filename); // report round trip times - boost::filesystem::remove(rtt_filename); + fs::remove(rtt_filename); } catch (std::exception& ex) { std::cout << "TestFixture::~TestFixture() caught exception " << ex.what() << "\n"; diff --git a/Udp/CMakeLists.txt b/Udp/CMakeLists.txt index 80448328f..3284d936c 100644 --- a/Udp/CMakeLists.txt +++ b/Udp/CMakeLists.txt @@ -64,7 +64,7 @@ ecbuild_add_executable( src LIBS ${LIB_TARGET} - core # Needed only to #include "ecflow_version.h" + core ) set_target_properties(${SERVER_TARGET} PROPERTIES INSTALL_RPATH "" diff --git a/Udp/test/TestSupport.hpp b/Udp/test/TestSupport.hpp index d48205047..a2f2fa188 100644 --- a/Udp/test/TestSupport.hpp +++ b/Udp/test/TestSupport.hpp @@ -15,7 +15,6 @@ #include #include -#include #include #include @@ -131,8 +130,7 @@ class MockServer : public BaseMockServer { std::string invoke_command = ecf::File::find_ecf_server_path(); BOOST_REQUIRE_MESSAGE(!invoke_command.empty(), "The server program could not be found"); - BOOST_REQUIRE_MESSAGE(boost::filesystem::exists(invoke_command), - "Server exe does not exist at:" << invoke_command); + BOOST_REQUIRE_MESSAGE(fs::exists(invoke_command), "Server exe does not exist at:" << invoke_command); invoke_command += " --port "; invoke_command += std::to_string(port); @@ -156,7 +154,7 @@ class MockServer : public BaseMockServer { host + '.' + std::to_string(port) + ".ecf.check.b", host + '.' + std::to_string(port) + ".ecf.log"}; for (const auto& t : temporaries) { - boost::filesystem::remove(t); + fs::remove(t); } } }; diff --git a/Viewer/ecflowUI/src/OutputDirClient.cpp b/Viewer/ecflowUI/src/OutputDirClient.cpp index c931e27d6..e02efe89d 100644 --- a/Viewer/ecflowUI/src/OutputDirClient.cpp +++ b/Viewer/ecflowUI/src/OutputDirClient.cpp @@ -12,10 +12,8 @@ #include -#include -#include - #include "UiLog.hpp" +#include "ecflow/core/Filesystem.hpp" #define _UI_OUTPUTDIRCLIENT_DEBUG @@ -99,7 +97,7 @@ void OutputDirClient::slotError(QAbstractSocket::SocketError err) { } void OutputDirClient::getDir(const std::string& name) { - boost::filesystem::path fp(name); + fs::path fp(name); std::string dirName = fp.parent_path().string(); remoteFile_ = name; @@ -137,9 +135,9 @@ void OutputDirClient::parseData() { in >> mode >> uid >> gid >> size >> atime >> mtime >> ctime >> name; if (!name.isEmpty()) { - boost::filesystem::path p(name.toStdString()); + fs::path p(name.toStdString()); std::string fileDirName = p.parent_path().string(); - std::string fileName = p.leaf().string(); + std::string fileName = p.filename().string(); // Adjust the path in the dir if (dir_->path() != fileDirName) { diff --git a/Viewer/ecflowUI/src/OutputDirProvider.cpp b/Viewer/ecflowUI/src/OutputDirProvider.cpp index 70bc4a8c6..df5ccb3fd 100644 --- a/Viewer/ecflowUI/src/OutputDirProvider.cpp +++ b/Viewer/ecflowUI/src/OutputDirProvider.cpp @@ -13,8 +13,6 @@ #include #include -#include -#include #include "OutputDirClient.hpp" #include "ServerHandler.hpp" @@ -23,6 +21,7 @@ #include "VFileTransfer.hpp" #include "VNode.hpp" #include "VReply.hpp" +#include "ecflow/core/Filesystem.hpp" // #define UI_OUTPUTDIRPROVIDER_DEBUG__ // #define UI_OUTPUTDIRPROVIDER_TASK_DEBUG__ @@ -192,18 +191,18 @@ void OutputDirFetchLocalTask::run() { #endif VDir_ptr res; - boost::filesystem::path p(filePath_); + fs::path p(filePath_); // Is it a directory? boost::system::error_code errorCode; - if (boost::filesystem::is_directory(p, errorCode)) { + if (fs::is_directory(p, errorCode)) { fail(); return; } auto reply = owner_->theReply(); try { - if (boost::filesystem::exists(p.parent_path())) { + if (fs::exists(p.parent_path())) { std::string dirName = p.parent_path().string(); // if(info_ && info_->isNode() && info_->node()) if (node_) { @@ -222,7 +221,7 @@ void OutputDirFetchLocalTask::run() { addTryLog(reply, "read from disk: NO ACCESS"); reply->appendErrorText("No access to path on disk!"); } - catch (const boost::filesystem::filesystem_error& e) { + catch (const fs::filesystem_error& e) { addTryLog(reply, "read from disk: NO ACCESS"); reply->appendErrorText("No access to path on disk! error: " + std::string(e.what())); // UiLog().warn() << "fetchLocalDir failed:" << std::string(e.what()); @@ -314,7 +313,7 @@ void OutputDirFetchTransferTask::transferFinished() { return; } - boost::filesystem::path fp(filePath_); + fs::path fp(filePath_); std::string dirName = fp.parent_path().string(); dir_ = std::make_shared(dirName); dir_->setFetchMode(VDir::TransferFetchMode); diff --git a/Viewer/ecflowUI/src/VConfig.cpp b/Viewer/ecflowUI/src/VConfig.cpp index 1c024139c..e9d5afc3b 100644 --- a/Viewer/ecflowUI/src/VConfig.cpp +++ b/Viewer/ecflowUI/src/VConfig.cpp @@ -10,8 +10,7 @@ #include "VConfig.hpp" -#include -#include +#include #include #include "DirectoryHandler.hpp" @@ -21,6 +20,7 @@ #include "VConfigLoader.hpp" #include "VProperty.hpp" #include "VSettings.hpp" +#include "ecflow/core/Filesystem.hpp" #include "ecflow/core/Str.hpp" #include "ecflow/core/Version.hpp" @@ -52,8 +52,6 @@ VConfig* VConfig::instance() { } void VConfig::init(const std::string& parDirPath) { - namespace fs = boost::filesystem; - fs::path parDir(parDirPath); if (fs::exists(parDir) && fs::is_directory(parDir)) { @@ -315,7 +313,7 @@ void VConfig::loadSettings(const std::string& parFile, VProperty* guiProp, bool read_json(parFile, pt); } catch (const boost::property_tree::json_parser::json_parser_error& e) { - if (boost::filesystem::exists(parFile)) { + if (fs::exists(parFile)) { std::string errorMessage = e.what(); UserMessage::message(UserMessage::ERROR, true, diff --git a/Viewer/ecflowUI/src/VDir.cpp b/Viewer/ecflowUI/src/VDir.cpp index 83f7f6d2b..f4e65b795 100644 --- a/Viewer/ecflowUI/src/VDir.cpp +++ b/Viewer/ecflowUI/src/VDir.cpp @@ -11,11 +11,10 @@ #include "VDir.hpp" #include -#include -#include #include #include "DirectoryHandler.hpp" +#include "ecflow/core/Filesystem.hpp" #include "ecflow/core/Str.hpp" VDir::VDir(const std::string& path) : path_(path), fetchMode_(NoFetchMode) { @@ -46,9 +45,9 @@ void VDir::clear() { void VDir::addItem(const std::string& name, unsigned int size, unsigned int mtime) { auto* item = new VDirItem; - boost::filesystem::path p(name); + fs::path p(name); // std::string dirName=p.parent_path().string(); - std::string fileName = p.leaf().string(); + std::string fileName = p.filename().string(); item->name_ = fileName; item->size_ = size; @@ -65,21 +64,21 @@ void VDir::reload() { where_ = "localhost"; - boost::filesystem::path path(path_); + fs::path path(path_); - boost::filesystem::directory_iterator it(path), eod; + fs::directory_iterator it(path), eod; - BOOST_FOREACH (boost::filesystem::path const& p, std::make_pair(it, eod)) { + BOOST_FOREACH (fs::path const& p, std::make_pair(it, eod)) { if (is_regular_file(p) && ecf::algorithm::starts_with(p.filename().string(), pattern_)) { auto* item = new VDirItem; item->name_ = p.filename().string(); - item->size_ = boost::filesystem::file_size(p); - item->size_ = boost::filesystem::file_size(p); + item->size_ = fs::file_size(p); + item->size_ = fs::file_size(p); #if QT_VERSION >= QT_VERSION_CHECK(5, 8, 0) - item->mtime_ = QDateTime::fromSecsSinceEpoch(boost::filesystem::last_write_time(p)); + item->mtime_ = QDateTime::fromSecsSinceEpoch(fs::last_write_time(p)); #else - item->mtime_ = QDateTime::fromTime_t(boost::filesystem::last_write_time(p)); + item->mtime_ = QDateTime::fromTime_t(fs::last_write_time(p)); #endif items_.push_back(item); } diff --git a/Viewer/ecflowUI/src/VServerSettings.cpp b/Viewer/ecflowUI/src/VServerSettings.cpp index c00e39f83..d1b007040 100644 --- a/Viewer/ecflowUI/src/VServerSettings.cpp +++ b/Viewer/ecflowUI/src/VServerSettings.cpp @@ -12,7 +12,6 @@ #include -#include #include #include "DirectoryHandler.hpp" @@ -26,6 +25,7 @@ #include "VConfigLoader.hpp" #include "VProperty.hpp" #include "VSettings.hpp" +#include "ecflow/core/Filesystem.hpp" std::map VServerSettings::notifyIds_; std::map VServerSettings::parNames_; @@ -169,7 +169,7 @@ void VServerSettings::loadSettings() { VConfig::instance()->loadSettings(fName, guiProp_, false); // Some settings are read through VSettings - if (boost::filesystem::exists(fName)) { + if (fs::exists(fName)) { VSettings vs(fName); vs.read(false); vs.beginGroup("suite_filter"); diff --git a/Viewer/ecflowUI/src/VSettings.cpp b/Viewer/ecflowUI/src/VSettings.cpp index cabfd2973..7528d0262 100644 --- a/Viewer/ecflowUI/src/VSettings.cpp +++ b/Viewer/ecflowUI/src/VSettings.cpp @@ -12,13 +12,12 @@ #include -#include -#include #include #include "DirectoryHandler.hpp" #include "UiLog.hpp" #include "UserMessage.hpp" +#include "ecflow/core/Filesystem.hpp" #include "ecflow/core/Str.hpp" // #define _UI_SETTINGS_DEBUG @@ -69,9 +68,8 @@ void VSettings::clear() { bool VSettings::fileExists() const { if (!file_.empty()) { - namespace fs = boost::filesystem; - fs::path boostpath(file_); - return fs::exists(boostpath); + fs::path path(file_); + return fs::exists(path); } return false; } diff --git a/Viewer/libViewer/src/DirectoryHandler.cpp b/Viewer/libViewer/src/DirectoryHandler.cpp index 2f640102e..1b5e63617 100644 --- a/Viewer/libViewer/src/DirectoryHandler.cpp +++ b/Viewer/libViewer/src/DirectoryHandler.cpp @@ -13,8 +13,6 @@ #include #include -#include -#include #include #include "UiLog.hpp" @@ -44,25 +42,25 @@ DirectoryHandler::DirectoryHandler() = default; // ----------------------------------------------------------------------------- void DirectoryHandler::init(const std::string& exeStr) { - boost::filesystem::path configDir; + fs::path configDir; // The location of the config dir is specified by the user // This could be the case for a ui test! In this case we // must not use the rcDir! if (char* confCh = getenv("ECFLOWUI_CONFIG_DIR")) { std::string confStr(confCh); - configDir = boost::filesystem::path(confStr); + configDir = fs::path(confStr); } // By default the config dir is .ecflow_ui_v5 in $HOME, // in this case we might import older settings from $HOME/.ecflowrc else if (char* h = getenv("HOME")) { std::string home(h); - boost::filesystem::path homeDir(home); + fs::path homeDir(home); - configDir = boost::filesystem::path(homeDir); + configDir = fs::path(homeDir); configDir /= ".ecflow_ui_v5"; - boost::filesystem::path rcDir = homeDir; + fs::path rcDir = homeDir; rcDir /= ".ecflowrc"; rcDir_ = rcDir.string(); } @@ -70,13 +68,13 @@ void DirectoryHandler::init(const std::string& exeStr) { // Sets configDir_ and creates it if it does not exist if (!configDir.string().empty()) { configDir_ = configDir.string(); - if (!boost::filesystem::exists(configDir)) { + if (!fs::exists(configDir)) { firstStartUp = true; try { - boost::filesystem::create_directory(configDir); + fs::create_directory(configDir); } - catch (const boost::filesystem::filesystem_error& err) { + catch (const fs::filesystem_error& err) { UserMessage::message( UserMessage::ERROR, true, @@ -96,14 +94,14 @@ void DirectoryHandler::init(const std::string& exeStr) { exit(1); } - boost::filesystem::path lgvConfigDir = configDir; + fs::path lgvConfigDir = configDir; lgvConfigDir /= "logviewer"; logviewerConfigDir_ = lgvConfigDir.string(); - if (!boost::filesystem::exists(lgvConfigDir)) { + if (!fs::exists(lgvConfigDir)) { try { - boost::filesystem::create_directory(lgvConfigDir); + fs::create_directory(lgvConfigDir); } - catch (const boost::filesystem::filesystem_error& err) { + catch (const fs::filesystem_error& err) { UserMessage::message( UserMessage::ERROR, true, @@ -113,14 +111,14 @@ void DirectoryHandler::init(const std::string& exeStr) { } // Sets paths in the system directory - boost::filesystem::path exePath(exeStr); + fs::path exePath(exeStr); // If the executable path does not exist we // will use the value of the ECFLOW_SHARED_DIR macro to get // the location of the "share/ecflow" dir. - if (!boost::filesystem::exists(exePath)) { - boost::filesystem::path shareDir(ECFLOW_SHARED_DIR); - if (!boost::filesystem::exists(shareDir)) { + if (!fs::exists(exePath)) { + fs::path shareDir(ECFLOW_SHARED_DIR); + if (!fs::exists(shareDir)) { UserMessage::message( UserMessage::ERROR, true, @@ -128,7 +126,7 @@ void DirectoryHandler::init(const std::string& exeStr) { exit(0); } - boost::filesystem::path etcDir = shareDir; + fs::path etcDir = shareDir; etcDir /= "etc"; shareDir_ = shareDir.string(); @@ -139,18 +137,18 @@ void DirectoryHandler::init(const std::string& exeStr) { exeDir_ = exePath.parent_path().string(); // TODO: make it work when we run it from within "bin" - boost::filesystem::path shareDir = exePath.parent_path().parent_path(); + fs::path shareDir = exePath.parent_path().parent_path(); shareDir /= "share"; shareDir /= "ecflow"; // In some debugging environments the exe might be another level deeper - if (!boost::filesystem::exists(shareDir)) { + if (!fs::exists(shareDir)) { shareDir = exePath.parent_path().parent_path().parent_path(); shareDir /= "share"; shareDir /= "ecflow"; } - boost::filesystem::path etcDir = shareDir; + fs::path etcDir = shareDir; etcDir /= "etc"; shareDir_ = shareDir.string(); @@ -163,20 +161,20 @@ void DirectoryHandler::init(const std::string& exeStr) { } else if (char* h = getenv("TMPDIR")) { tmpDir_ = std::string(h); - boost::filesystem::path tmp(tmpDir_); + fs::path tmp(tmpDir_); tmp /= "ecflow_ui.tmp"; tmpDir_ = tmp.string(); - if (!boost::filesystem::exists(tmp)) { + if (!fs::exists(tmp)) { UiLog().warn() << "ECFLOWUI_TMPDIR env variable is not defined. ecFlowUI creates its tmp direcoty in TMPDIR as " << tmp.string(); try { - if (boost::filesystem::create_directory(tmp)) { + if (fs::create_directory(tmp)) { UiLog().dbg() << "Tmp dir created: " << tmpDir_; } } - catch (const boost::filesystem::filesystem_error& e) { + catch (const fs::filesystem_error& e) { UserMessage::message( UserMessage::ERROR, true, "Creating tmp directory failed:" + std::string(e.what())); } @@ -200,7 +198,7 @@ void DirectoryHandler::init(const std::string& exeStr) { uiEventLogFile_ = std::string(h); } else { - boost::filesystem::path tmp(tmpDir_); + fs::path tmp(tmpDir_); tmp /= "ecflowui_uilog.txt"; uiEventLogFile_ = tmp.string(); } @@ -210,16 +208,16 @@ void DirectoryHandler::init(const std::string& exeStr) { socketDir_ = std::string(h); } else { - boost::filesystem::path tmp(tmpDir_); + fs::path tmp(tmpDir_); // tmp /= "sockets"; socketDir_ = tmp.string(); } } std::string DirectoryHandler::concatenate(const std::string& path1, const std::string& path2) { - boost::filesystem::path p1(path1); - boost::filesystem::path p2(path2); - boost::filesystem::path result = p1 /= p2; + fs::path p1(path1); + fs::path p2(path2); + fs::path result = p1 /= p2; return result.string(); } @@ -227,12 +225,12 @@ void DirectoryHandler::findDirContents(const std::string& dirPath, const std::string& filterStr, FileType type, std::vector& res) { - boost::filesystem::path path(dirPath); - boost::filesystem::directory_iterator it(path), eod; + fs::path path(dirPath); + fs::directory_iterator it(path), eod; const std::regex expr(filterStr); - BOOST_FOREACH (boost::filesystem::path const& p, std::make_pair(it, eod)) { + BOOST_FOREACH (fs::path const& p, std::make_pair(it, eod)) { std::smatch what; std::string fileName = p.filename().string(); @@ -258,11 +256,11 @@ void DirectoryHandler::findDirs(const std::string& dirPath, bool DirectoryHandler::createDir(const std::string& path) { // Create configDir if if does not exist - if (!boost::filesystem::exists(path)) { + if (!fs::exists(path)) { try { - boost::filesystem::create_directory(path); + fs::create_directory(path); } - catch (const boost::filesystem::filesystem_error& err) { + catch (const fs::filesystem_error& err) { UserMessage::message(UserMessage::ERROR, true, "Could not create dir: " + path + " reason: " + err.what()); return false; } @@ -277,14 +275,14 @@ bool DirectoryHandler::isFirstStartUp() { // Return a unique non-existing tmp filename std::string DirectoryHandler::tmpFileName() { - boost::filesystem::path tmp(tmpDir_); - if (boost::filesystem::exists(tmp)) { + fs::path tmp(tmpDir_); + if (fs::exists(tmp)) { try { - boost::filesystem::path model = tmp; + fs::path model = tmp; model /= "%%%%-%%%%-%%%%-%%%%"; - return boost::filesystem::unique_path(model).string(); + return fs::unique_path(model).string(); } - catch (const boost::filesystem::filesystem_error& err) { + catch (const fs::filesystem_error& err) { UiLog().warn() << "Could not generate tmp filename! Reason: " << err.what(); } } @@ -298,17 +296,17 @@ std::string DirectoryHandler::tmpFileName() { // ----------------------------------------------------- bool DirectoryHandler::copyDir(const std::string& srcDir, const std::string& destDir, std::string& errorMessage) { - boost::filesystem::path src(srcDir); - boost::filesystem::path dest(destDir); + fs::path src(srcDir); + fs::path dest(destDir); // does the source directory exist (and is a directory)? - if (!boost::filesystem::exists(src) || !boost::filesystem::is_directory(src)) { + if (!fs::exists(src) || !fs::is_directory(src)) { errorMessage = "Source directory (" + srcDir + ") does not exist"; return false; } // create the destination directory if it does not already exist - if (!boost::filesystem::exists(dest)) { + if (!fs::exists(dest)) { bool created = createDir(dest.string()); if (!created) { errorMessage = "Could not create destination directory (" + destDir + ")"; @@ -318,8 +316,8 @@ bool DirectoryHandler::copyDir(const std::string& srcDir, const std::string& des // go through all the files/dirs in the dir bool ok = true; - boost::filesystem::directory_iterator it(src), eod; - BOOST_FOREACH (boost::filesystem::path const& p, std::make_pair(it, eod)) { + fs::directory_iterator it(src), eod; + BOOST_FOREACH (fs::path const& p, std::make_pair(it, eod)) { std::string fileName = p.filename().string(); std::string srcFile = p.string(); @@ -327,17 +325,17 @@ bool DirectoryHandler::copyDir(const std::string& srcDir, const std::string& des { // The original boost based copy implementation did not work with newer compilers, // so we opted for a Qt based implementation. See ECFLOW-1207 - boost::filesystem::path destPath = dest / p.filename(); - std::string destFile = destPath.string(); + fs::path destPath = dest / p.filename(); + std::string destFile = destPath.string(); if (!copyFile(srcFile, destFile, errorMessage)) return false; #if 0 try { - boost::filesystem::copy_file(p, dest / p.filename()); + fs::copy_file(p, dest / p.filename()); } - catch (const boost::filesystem::filesystem_error& err) + catch (const fs::filesystem_error& err) { errorMessage = "Could not copy file " + fileName + " to " + destDir + "; reason: " + err.what(); return false; @@ -346,7 +344,7 @@ bool DirectoryHandler::copyDir(const std::string& srcDir, const std::string& des } else if (is_directory(p)) // directory? then copy it recursively { - boost::filesystem::path destSubDir(destDir); + fs::path destSubDir(destDir); destSubDir /= p.filename(); ok = ok && copyDir(p.string(), destSubDir.string(), errorMessage); } @@ -362,10 +360,10 @@ bool DirectoryHandler::copyDir(const std::string& srcDir, const std::string& des bool DirectoryHandler::removeDir(const std::string& dir, std::string& errorMessage) { try { - boost::filesystem::path d(dir); + fs::path d(dir); remove_all(d); } - catch (const boost::filesystem::filesystem_error& err) { + catch (const fs::filesystem_error& err) { errorMessage = "Could not remove directory " + dir + "; reason: " + err.what(); return false; } @@ -380,11 +378,11 @@ bool DirectoryHandler::removeDir(const std::string& dir, std::string& errorMessa bool DirectoryHandler::renameDir(const std::string& dir, const std::string& newName, std::string& errorMessage) { try { - boost::filesystem::path d1(dir); - boost::filesystem::path d2(newName); + fs::path d1(dir); + fs::path d2(newName); rename(d1, d2); } - catch (const boost::filesystem::filesystem_error& err) { + catch (const fs::filesystem_error& err) { errorMessage = "Could not rename directory " + dir + "; reason: " + err.what(); return false; } @@ -422,14 +420,14 @@ bool DirectoryHandler::copyFile(const std::string& srcFile, std::string& destFil return true; #if 0 - boost::filesystem::path src(srcFile); - boost::filesystem::path dest(destFile); + fs::path src(srcFile); + fs::path dest(destFile); try { - boost::filesystem::copy_file(src, dest, boost::filesystem::copy_option::overwrite_if_exists); + fs::copy_file(src, dest, fs::copy_option::overwrite_if_exists); } - catch (const boost::filesystem::filesystem_error& err) + catch (const fs::filesystem_error& err) { errorMessage = "Could not copy file " + srcFile + " to " + destFile + "; reason: " + err.what(); return false; @@ -446,10 +444,10 @@ bool DirectoryHandler::copyFile(const std::string& srcFile, std::string& destFil bool DirectoryHandler::removeFile(const std::string& path, std::string& errorMessage) { try { - boost::filesystem::path f(path); + fs::path f(path); remove(f); } - catch (const boost::filesystem::filesystem_error& err) { + catch (const fs::filesystem_error& err) { errorMessage = "Could not remove file " + path + "; reason: " + err.what(); return false; }