Change filesystem from klay to boost
authorSangwan Kwon <sangwan.kwon@samsung.com>
Fri, 29 Nov 2019 04:59:32 +0000 (13:59 +0900)
committer권상완/Security 2Lab(SR)/Engineer/삼성전자 <sangwan.kwon@samsung.com>
Mon, 2 Dec 2019 06:36:38 +0000 (15:36 +0900)
Signed-off-by: Sangwan Kwon <sangwan.kwon@samsung.com>
src/vist/policy/policy-manager.cpp

index a7431b6..9d25929 100644 (file)
@@ -20,7 +20,7 @@
 #include <vist/exception.hpp>
 #include <vist/logger.hpp>
 
-#include <klay/filesystem.h>
+#include <boost/filesystem.hpp>
 
 #include <algorithm>
 
@@ -39,18 +39,17 @@ PolicyManager::PolicyManager() : storage(DB_PATH)
 std::pair<int, int> PolicyManager::loadProviders(const std::string& path)
 {
        INFO(VIST) << "Load policies from :" << path;
-       klay::File dir(path);
-       if (!dir.exists() || !dir.isDirectory())
+       using namespace boost::filesystem;
+       if (!is_directory(path))
                THROW(ErrCode::LogicError) << "Plugin directory is wrong.: " << path;
 
        int passed = 0, failed = 0;
-       klay::DirectoryIterator end;
-       for (klay::DirectoryIterator iter(path); iter != end; ++iter) {
-               if (!iter->isFile())
+       for (directory_entry& entry : directory_iterator(path)) {
+               if (!is_regular_file(entry.path().string()))
                        continue;
 
                try {
-                       auto provider = PolicyLoader::load(iter->getPath());
+                       auto provider = PolicyLoader::load(entry.path().string());
                        DEBUG(VIST) << "Loaded provider: " << provider->getName();
 
                        bool exist = false;
@@ -65,7 +64,7 @@ std::pair<int, int> PolicyManager::loadProviders(const std::string& path)
                                this->providers.emplace_back(std::move(provider));
                } catch (const std::exception& e) {
                        ++failed;
-                       ERROR(VIST) << "Failed to load: " << iter->getPath() << e.what();
+                       ERROR(VIST) << "Failed to load: " << entry.path().string() << e.what();
                        continue;
                }