1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-04-07 13:20:25 +00:00

Remove even most boost::

This commit is contained in:
jvoisin 2022-05-26 16:13:07 +02:00
parent d74ee0f3fe
commit 21efb74b58
2 changed files with 11 additions and 10 deletions

View File

@ -7,8 +7,8 @@
#include <osg/Program> #include <osg/Program>
#include <boost/filesystem/path.hpp> #include <filesystem>
#include <boost/filesystem/fstream.hpp> #include <fstream>
#include <components/debug/debuglog.hpp> #include <components/debug/debuglog.hpp>
#include <components/misc/stringops.hpp> #include <components/misc/stringops.hpp>
@ -69,7 +69,7 @@ namespace Shader
// Recursively replaces include statements with the actual source of the included files. // Recursively replaces include statements with the actual source of the included files.
// Adjusts #line statements accordingly and detects cyclic includes. // Adjusts #line statements accordingly and detects cyclic includes.
// includingFiles is the set of files that include this file directly or indirectly, and is intentionally not a reference to allow automatic cleanup. // includingFiles is the set of files that include this file directly or indirectly, and is intentionally not a reference to allow automatic cleanup.
static bool parseIncludes(const boost::filesystem::path& shaderPath, std::string& source, const std::string& fileName, int& fileNumber, std::set<boost::filesystem::path> includingFiles) static bool parseIncludes(const std::filesystem::path& shaderPath, std::string& source, const std::string& fileName, int& fileNumber, std::set<std::filesystem::path> includingFiles)
{ {
// An include is cyclic if it is being included by itself // An include is cyclic if it is being included by itself
if (includingFiles.insert(shaderPath/fileName).second == false) if (includingFiles.insert(shaderPath/fileName).second == false)
@ -96,7 +96,7 @@ namespace Shader
return false; return false;
} }
std::string includeFilename = source.substr(start + 1, end - (start + 1)); std::string includeFilename = source.substr(start + 1, end - (start + 1));
boost::filesystem::path includePath = shaderPath / includeFilename; std::filesystem::path includePath = shaderPath / includeFilename;
// Determine the line number that will be used for the #line directive following the included source // Determine the line number that will be used for the #line directive following the included source
size_t lineDirectivePosition = source.rfind("#line", foundPos); size_t lineDirectivePosition = source.rfind("#line", foundPos);
@ -116,7 +116,7 @@ namespace Shader
lineNumber += std::count(source.begin() + lineDirectivePosition, source.begin() + foundPos, '\n'); lineNumber += std::count(source.begin() + lineDirectivePosition, source.begin() + foundPos, '\n');
// Include the file recursively // Include the file recursively
boost::filesystem::ifstream includeFstream; std::ifstream includeFstream;
includeFstream.open(includePath); includeFstream.open(includePath);
if (includeFstream.fail()) if (includeFstream.fail())
{ {
@ -364,8 +364,8 @@ namespace Shader
TemplateMap::iterator templateIt = mShaderTemplates.find(templateName); TemplateMap::iterator templateIt = mShaderTemplates.find(templateName);
if (templateIt == mShaderTemplates.end()) if (templateIt == mShaderTemplates.end())
{ {
boost::filesystem::path path = (boost::filesystem::path(mPath) / templateName); std::filesystem::path path = (std::filesystem::path(mPath) / templateName);
boost::filesystem::ifstream stream; std::ifstream stream;
stream.open(path); stream.open(path);
if (stream.fail()) if (stream.fail())
{ {
@ -379,7 +379,7 @@ namespace Shader
int fileNumber = 1; int fileNumber = 1;
std::string source = buffer.str(); std::string source = buffer.str();
if (!addLineDirectivesAfterConditionalBlocks(source) if (!addLineDirectivesAfterConditionalBlocks(source)
|| !parseIncludes(boost::filesystem::path(mPath), source, templateName, fileNumber, {})) || !parseIncludes(std::filesystem::path(mPath), source, templateName, fileNumber, {}))
return nullptr; return nullptr;
templateIt = mShaderTemplates.insert(std::make_pair(templateName, source)).first; templateIt = mShaderTemplates.insert(std::make_pair(templateName, source)).first;

View File

@ -2,6 +2,7 @@
#include <set> #include <set>
#include <sstream> #include <sstream>
#include <filesystem>
#include <components/debug/debuglog.hpp> #include <components/debug/debuglog.hpp>
@ -40,10 +41,10 @@ namespace VFS
if (useLooseFiles) if (useLooseFiles)
{ {
std::set<boost::filesystem::path> seen; std::set<std::filesystem::path> seen;
for (Files::PathContainer::const_iterator iter = dataDirs.begin(); iter != dataDirs.end(); ++iter) for (Files::PathContainer::const_iterator iter = dataDirs.begin(); iter != dataDirs.end(); ++iter)
{ {
if (seen.insert(*iter).second) if (seen.insert((*iter).c_str()).second)
{ {
Log(Debug::Info) << "Adding data directory " << iter->string(); Log(Debug::Info) << "Adding data directory " << iter->string();
// Last data dir has the highest priority // Last data dir has the highest priority