From 3efb33dc69af0584c12ae2f8c9bf1ba03de4ce01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1t=C3=A9=20Cser=C3=A9p?= Date: Tue, 16 Jul 2024 06:42:37 +0200 Subject: [PATCH] Make codebase compatible with Boost 1.85 deprecation removals. --- parser/src/pluginhandler.cpp | 4 ++-- plugins/cpp/parser/src/cppparser.cpp | 6 +++--- plugins/cpp/service/src/filediagram.cpp | 2 +- plugins/dummy/parser/src/dummyparser.cpp | 2 +- plugins/git/parser/src/gitparser.cpp | 2 +- plugins/git/service/src/gitservice.cpp | 2 +- plugins/search/parser/src/searchparser.cpp | 2 +- webserver/include/webserver/pluginhandler.h | 2 +- 8 files changed, 11 insertions(+), 11 deletions(-) diff --git a/parser/src/pluginhandler.cpp b/parser/src/pluginhandler.cpp index 7fe6c91e1..e656e31de 100644 --- a/parser/src/pluginhandler.cpp +++ b/parser/src/pluginhandler.cpp @@ -44,7 +44,7 @@ void PluginHandler::loadPlugins(std::vector& skipParserList_) ++dirIter) { if (fs::is_regular_file(dirIter->status()) && - fs::extension(*dirIter) == util::DynamicLibrary::extension()) + fs::path(*dirIter).extension() == util::DynamicLibrary::extension()) { std::string filename = getPluginName(dirIter->path()); @@ -85,7 +85,7 @@ std::vector PluginHandler::getPluginNames() const ++dirIter) { if (fs::is_regular_file(dirIter->status()) && - fs::extension(*dirIter) == util::DynamicLibrary::extension()) + fs::path(*dirIter).extension() == util::DynamicLibrary::extension()) { plugins.push_back(getPluginName(dirIter->path())); } diff --git a/plugins/cpp/parser/src/cppparser.cpp b/plugins/cpp/parser/src/cppparser.cpp index 685487c80..0a09dd105 100644 --- a/plugins/cpp/parser/src/cppparser.cpp +++ b/plugins/cpp/parser/src/cppparser.cpp @@ -159,7 +159,7 @@ bool CppParser::isSourceFile(const std::string& file_) const const std::vector cppExts{ ".c", ".cc", ".cpp", ".cxx", ".o", ".so", ".a"}; - std::string ext = fs::extension(file_); + std::string ext = fs::path(file_).extension().string(); std::transform(ext.begin(), ext.end(), ext.begin(), ::tolower); return std::find(cppExts.begin(), cppExts.end(), ext) != cppExts.end(); @@ -219,7 +219,7 @@ std::map CppParser::extractInputOutputs( { for (const std::string& src : sources) { - std::string extension = fs::extension(src); + std::string extension = fs::path(src).extension().string(); inToOut[src] = src.substr(0, src.size() - extension.size() - 1) + ".o"; } } @@ -242,7 +242,7 @@ model::BuildActionPtr CppParser::addBuildAction( model::BuildActionPtr buildAction(new model::BuildAction); - std::string extension = fs::extension(command_.Filename); + auto extension = fs::path(command_.Filename).extension(); buildAction->command = boost::algorithm::join(command_.CommandLine, " "); buildAction->type diff --git a/plugins/cpp/service/src/filediagram.cpp b/plugins/cpp/service/src/filediagram.cpp index 44c3bf788..47d195c3a 100644 --- a/plugins/cpp/service/src/filediagram.cpp +++ b/plugins/cpp/service/src/filediagram.cpp @@ -711,7 +711,7 @@ util::Graph::Node FileDiagram::addNode( } else if (fileInfo_.type == "CPP") { - std::string ext = boost::filesystem::extension(fileInfo_.path); + std::string ext = boost::filesystem::path(fileInfo_.path).extension().string(); std::transform(ext.begin(), ext.end(), ext.begin(), ::tolower); if (ext == ".cpp" || ext == ".cxx" || ext == ".cc" || ext == ".c") diff --git a/plugins/dummy/parser/src/dummyparser.cpp b/plugins/dummy/parser/src/dummyparser.cpp index 9c3f2ff1e..da92f0b62 100644 --- a/plugins/dummy/parser/src/dummyparser.cpp +++ b/plugins/dummy/parser/src/dummyparser.cpp @@ -17,7 +17,7 @@ DummyParser::DummyParser(ParserContext& ctx_): AbstractParser(ctx_) bool DummyParser::accept(const std::string& path_) { - std::string ext = boost::filesystem::extension(path_); + auto ext = boost::filesystem::path(path_).extension(); return ext == ".dummy"; } diff --git a/plugins/git/parser/src/gitparser.cpp b/plugins/git/parser/src/gitparser.cpp index 82c09edce..b33169cbe 100644 --- a/plugins/git/parser/src/gitparser.cpp +++ b/plugins/git/parser/src/gitparser.cpp @@ -164,7 +164,7 @@ util::DirIterCallback GitParser::getParserCallback() boost::property_tree::ptree pt; std::string repoFile(versionDataDir + "/repositories.txt"); - if (boost::filesystem::is_regular(repoFile)) + if (boost::filesystem::is_regular_file(repoFile)) boost::property_tree::read_ini(repoFile, pt); pt.put(repoId + ".name", path.filename().string()); diff --git a/plugins/git/service/src/gitservice.cpp b/plugins/git/service/src/gitservice.cpp index 88c8578fb..54f05f161 100644 --- a/plugins/git/service/src/gitservice.cpp +++ b/plugins/git/service/src/gitservice.cpp @@ -151,7 +151,7 @@ void GitServiceHandler::getRepositoryList(std::vector& return_) std::string repoFile(versionDataDir.string() + "/repositories.txt"); boost::property_tree::ptree pt; - if (!fs::is_regular(repoFile)) + if (!fs::is_regular_file(repoFile)) { LOG(warning) << "Repository file not found in data directory: " << repoFile; return; diff --git a/plugins/search/parser/src/searchparser.cpp b/plugins/search/parser/src/searchparser.cpp index 9306e04cd..cc5a97334 100644 --- a/plugins/search/parser/src/searchparser.cpp +++ b/plugins/search/parser/src/searchparser.cpp @@ -173,7 +173,7 @@ bool SearchParser::shouldHandle(const std::string& path_) { //--- The file is not regular. ---// - if (!fs::is_regular(path_)) + if (!fs::is_regular_file(path_)) return false; //--- The file is excluded by suffix. ---// diff --git a/webserver/include/webserver/pluginhandler.h b/webserver/include/webserver/pluginhandler.h index 8d80ce543..84fd09686 100644 --- a/webserver/include/webserver/pluginhandler.h +++ b/webserver/include/webserver/pluginhandler.h @@ -44,7 +44,7 @@ class PluginHandler for (fs::directory_iterator dirIter(path_); dirIter != endIter; ++dirIter) { if (fs::is_regular_file(dirIter->status()) - && fs::extension(*dirIter) == util::DynamicLibrary::extension()) + && fs::path(*dirIter).extension() == util::DynamicLibrary::extension()) { _dynamicLibraries.emplace_back(util::DynamicLibraryPtr( new util::DynamicLibrary(dirIter->path().string())));