1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-26 09:35:28 +00:00

Merge branch 'less_boost' into 'master'

Remove even most boost::

See merge request OpenMW/openmw!1935
This commit is contained in:
psi29a 2022-05-26 20:35:34 +00:00
commit cc9e39c0de
2 changed files with 11 additions and 10 deletions

View File

@ -7,8 +7,8 @@
#include <osg/Program>
#include <boost/filesystem/path.hpp>
#include <boost/filesystem/fstream.hpp>
#include <filesystem>
#include <fstream>
#include <components/debug/debuglog.hpp>
#include <components/misc/stringops.hpp>
@ -69,7 +69,7 @@ namespace Shader
// Recursively replaces include statements with the actual source of the included files.
// 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.
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
if (includingFiles.insert(shaderPath/fileName).second == false)
@ -96,7 +96,7 @@ namespace Shader
return false;
}
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
size_t lineDirectivePosition = source.rfind("#line", foundPos);
@ -116,7 +116,7 @@ namespace Shader
lineNumber += std::count(source.begin() + lineDirectivePosition, source.begin() + foundPos, '\n');
// Include the file recursively
boost::filesystem::ifstream includeFstream;
std::ifstream includeFstream;
includeFstream.open(includePath);
if (includeFstream.fail())
{
@ -364,8 +364,8 @@ namespace Shader
TemplateMap::iterator templateIt = mShaderTemplates.find(templateName);
if (templateIt == mShaderTemplates.end())
{
boost::filesystem::path path = (boost::filesystem::path(mPath) / templateName);
boost::filesystem::ifstream stream;
std::filesystem::path path = (std::filesystem::path(mPath) / templateName);
std::ifstream stream;
stream.open(path);
if (stream.fail())
{
@ -379,7 +379,7 @@ namespace Shader
int fileNumber = 1;
std::string source = buffer.str();
if (!addLineDirectivesAfterConditionalBlocks(source)
|| !parseIncludes(boost::filesystem::path(mPath), source, templateName, fileNumber, {}))
|| !parseIncludes(std::filesystem::path(mPath), source, templateName, fileNumber, {}))
return nullptr;
templateIt = mShaderTemplates.insert(std::make_pair(templateName, source)).first;

View File

@ -2,6 +2,7 @@
#include <set>
#include <sstream>
#include <filesystem>
#include <components/debug/debuglog.hpp>
@ -40,10 +41,10 @@ namespace VFS
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)
{
if (seen.insert(*iter).second)
if (seen.insert((*iter).c_str()).second)
{
Log(Debug::Info) << "Adding data directory " << iter->string();
// Last data dir has the highest priority