Remove boost::filesystem from a couple of files

fix/shrink_builds
jvoisin 3 years ago committed by AnyOldName3
parent aa027c2c3f
commit 6feb92a9bf

@ -4,8 +4,8 @@
#include <MyGUI_InputManager.h> #include <MyGUI_InputManager.h>
#include <MyGUI_LayerManager.h> #include <MyGUI_LayerManager.h>
#include <boost/filesystem.hpp> #include <filesystem>
#include <boost/filesystem/fstream.hpp> #include <fstream>
#include <components/compiler/exception.hpp> #include <components/compiler/exception.hpp>
#include <components/compiler/extensions0.hpp> #include <components/compiler/extensions0.hpp>
@ -220,8 +220,7 @@ namespace MWGui
void Console::executeFile (const std::string& path) void Console::executeFile (const std::string& path)
{ {
namespace bfs = boost::filesystem; std::ifstream stream ((std::filesystem::path(path)));
bfs::ifstream stream ((bfs::path(path)));
if (!stream.is_open()) if (!stream.is_open())
printError ("failed to open file: " + path); printError ("failed to open file: " + path);

@ -3,6 +3,7 @@
#include <algorithm> #include <algorithm>
#include <cassert> #include <cassert>
#include <chrono> #include <chrono>
#include <filesystem>
#include <thread> #include <thread>
#include <osgViewer/Viewer> #include <osgViewer/Viewer>
@ -195,7 +196,7 @@ namespace MWGui
{ {
mScalingFactor = std::clamp(Settings::Manager::getFloat("scaling factor", "GUI"), 0.5f, 8.f); mScalingFactor = std::clamp(Settings::Manager::getFloat("scaling factor", "GUI"), 0.5f, 8.f);
mGuiPlatform = new osgMyGUI::Platform(viewer, guiRoot, resourceSystem->getImageManager(), mScalingFactor); mGuiPlatform = new osgMyGUI::Platform(viewer, guiRoot, resourceSystem->getImageManager(), mScalingFactor);
mGuiPlatform->initialise(resourcePath, (boost::filesystem::path(logpath) / "MyGUI.log").generic_string()); mGuiPlatform->initialise(resourcePath, (std::filesystem::path(logpath) / "MyGUI.log").generic_string());
mGui = new MyGUI::Gui; mGui = new MyGUI::Gui;
mGui->initialise(""); mGui->initialise("");

@ -23,11 +23,11 @@
#include "bsa_file.hpp" #include "bsa_file.hpp"
#include <algorithm>
#include <cassert> #include <cassert>
#include <cstring>
#include <boost/filesystem/path.hpp> #include <filesystem>
#include <boost/filesystem/fstream.hpp> #include <fstream>
#include <boost/filesystem/operations.hpp>
using namespace Bsa; using namespace Bsa;
@ -98,8 +98,7 @@ void BSAFile::readHeader()
*/ */
assert(!mIsLoaded); assert(!mIsLoaded);
namespace bfs = boost::filesystem; std::ifstream input(std::filesystem::path(mFilename), std::ios_base::binary);
bfs::ifstream input(bfs::path(mFilename), std::ios_base::binary);
// Total archive size // Total archive size
std::streamoff fsize = 0; std::streamoff fsize = 0;
@ -195,8 +194,7 @@ void BSAFile::readHeader()
/// Write header information to the output sink /// Write header information to the output sink
void Bsa::BSAFile::writeHeader() void Bsa::BSAFile::writeHeader()
{ {
namespace bfs = boost::filesystem; std::fstream output(mFilename, std::ios::binary | std::ios::in | std::ios::out);
bfs::fstream output(mFilename, std::ios::binary | std::ios::in | std::ios::out);
uint32_t head[3]; uint32_t head[3];
head[0] = 0x100; head[0] = 0x100;
@ -237,11 +235,11 @@ void BSAFile::open(const std::string &file)
close(); close();
mFilename = file; mFilename = file;
if(boost::filesystem::exists(file)) if(std::filesystem::exists(file))
readHeader(); readHeader();
else else
{ {
{ boost::filesystem::fstream(mFilename, std::ios::binary | std::ios::out); } { std::fstream(mFilename, std::ios::binary | std::ios::out); }
writeHeader(); writeHeader();
mIsLoaded = true; mIsLoaded = true;
} }
@ -262,13 +260,12 @@ void Bsa::BSAFile::addFile(const std::string& filename, std::istream& file)
{ {
if (!mIsLoaded) if (!mIsLoaded)
fail("Unable to add file " + filename + " the archive is not opened"); fail("Unable to add file " + filename + " the archive is not opened");
namespace bfs = boost::filesystem;
auto newStartOfDataBuffer = 12 + (12 + 8) * (mFiles.size() + 1) + mStringBuf.size() + filename.size() + 1; auto newStartOfDataBuffer = 12 + (12 + 8) * (mFiles.size() + 1) + mStringBuf.size() + filename.size() + 1;
if (mFiles.empty()) if (mFiles.empty())
bfs::resize_file(mFilename, newStartOfDataBuffer); std::filesystem::resize_file(mFilename, newStartOfDataBuffer);
bfs::fstream stream(mFilename, std::ios::binary | std::ios::in | std::ios::out); std::fstream stream(mFilename, std::ios::binary | std::ios::in | std::ios::out);
FileStruct newFile; FileStruct newFile;
file.seekg(0, std::ios::end); file.seekg(0, std::ios::end);

@ -26,12 +26,12 @@
#include <stdexcept> #include <stdexcept>
#include <cassert> #include <cassert>
#include <filesystem>
#include <fstream>
#include <lz4frame.h> #include <lz4frame.h>
#include <boost/scoped_array.hpp> #include <boost/scoped_array.hpp>
#include <boost/filesystem/path.hpp>
#include <boost/filesystem/fstream.hpp>
#include <boost/iostreams/filtering_streambuf.hpp> #include <boost/iostreams/filtering_streambuf.hpp>
#include <boost/iostreams/copy.hpp> #include <boost/iostreams/copy.hpp>
@ -119,8 +119,7 @@ void CompressedBSAFile::readHeader()
{ {
assert(!mIsLoaded); assert(!mIsLoaded);
namespace bfs = boost::filesystem; std::ifstream input(std::filesystem::path(mFilename), std::ios_base::binary);
bfs::ifstream input(bfs::path(mFilename), std::ios_base::binary);
// Total archive size // Total archive size
std::streamoff fsize = 0; std::streamoff fsize = 0;
@ -306,7 +305,7 @@ CompressedBSAFile::FileRecord CompressedBSAFile::getFileRecord(const std::string
std::string path = str; std::string path = str;
std::replace(path.begin(), path.end(), '\\', '/'); std::replace(path.begin(), path.end(), '\\', '/');
boost::filesystem::path p(path); std::filesystem::path p(path);
std::string stem = p.stem().string(); std::string stem = p.stem().string();
std::string ext = p.extension().string(); std::string ext = p.extension().string();
p.remove_filename(); p.remove_filename();
@ -408,8 +407,7 @@ Files::IStreamPtr CompressedBSAFile::getFile(const FileRecord& fileRecord)
BsaVersion CompressedBSAFile::detectVersion(const std::string& filePath) BsaVersion CompressedBSAFile::detectVersion(const std::string& filePath)
{ {
namespace bfs = boost::filesystem; std::ifstream input(std::filesystem::path(filePath), std::ios_base::binary);
bfs::ifstream input(bfs::path(filePath), std::ios_base::binary);
// Total archive size // Total archive size
std::streamoff fsize = 0; std::streamoff fsize = 0;

@ -7,8 +7,6 @@
#include <QDebug> #include <QDebug>
#include <boost/filesystem/operations.hpp>
#include <components/files/configurationmanager.hpp> #include <components/files/configurationmanager.hpp>
const char Config::LauncherSettings::sCurrentContentListKey[] = "Profiles/currentprofile"; const char Config::LauncherSettings::sCurrentContentListKey[] = "Profiles/currentprofile";

@ -1,11 +1,11 @@
#include "esmreader.hpp" #include "esmreader.hpp"
#include <boost/filesystem/path.hpp>
#include <components/misc/stringops.hpp> #include <components/misc/stringops.hpp>
#include <components/files/openfile.hpp> #include <components/files/openfile.hpp>
#include <stdexcept> #include <stdexcept>
#include <sstream> #include <sstream>
#include <filesystem>
#include <fstream> #include <fstream>
namespace ESM namespace ESM
@ -74,7 +74,7 @@ void ESMReader::resolveParentFileIndices(const std::vector<ESMReader>& allPlugin
if (reader.getFileSize() == 0) if (reader.getFileSize() == 0)
continue; // Content file in non-ESM format continue; // Content file in non-ESM format
const std::string& candidate = reader.getName(); const std::string& candidate = reader.getName();
std::string fnamecandidate = boost::filesystem::path(candidate).filename().string(); std::string fnamecandidate = std::filesystem::path(candidate).filename().string();
if (Misc::StringUtils::ciEqual(fname, fnamecandidate)) { if (Misc::StringUtils::ciEqual(fname, fnamecandidate)) {
index = i; index = i;
break; break;

@ -1,5 +1,6 @@
#include "fontloader.hpp" #include "fontloader.hpp"
#include <filesystem>
#include <stdexcept> #include <stdexcept>
#include <string_view> #include <string_view>
#include <array> #include <array>
@ -216,7 +217,7 @@ namespace Gui
const std::string cfg = dataManager->getDataPath(""); const std::string cfg = dataManager->getDataPath("");
const std::string fontFile = mUserDataPath + "/" + "Fonts" + "/" + "openmw_font.xml"; const std::string fontFile = mUserDataPath + "/" + "Fonts" + "/" + "openmw_font.xml";
if (!boost::filesystem::exists(fontFile)) if (!std::filesystem::exists(fontFile))
return; return;
dataManager->setResourcePath(mUserDataPath + "/" + "Fonts"); dataManager->setResourcePath(mUserDataPath + "/" + "Fonts");

@ -1,8 +1,6 @@
#ifndef OPENMW_COMPONENTS_FONTLOADER_H #ifndef OPENMW_COMPONENTS_FONTLOADER_H
#define OPENMW_COMPONENTS_FONTLOADER_H #define OPENMW_COMPONENTS_FONTLOADER_H
#include "boost/filesystem/operations.hpp"
#include <MyGUI_XmlDocument.h> #include <MyGUI_XmlDocument.h>
#include <MyGUI_Version.h> #include <MyGUI_Version.h>

@ -5,8 +5,8 @@
#include <MyGUI_DataFileStream.h> #include <MyGUI_DataFileStream.h>
#include <boost/filesystem/operations.hpp> #include <filesystem>
#include <boost/filesystem/fstream.hpp> #include <fstream>
#include <components/debug/debuglog.hpp> #include <components/debug/debuglog.hpp>
@ -21,8 +21,8 @@ void DataManager::setResourcePath(const std::string &path)
MyGUI::IDataStream *DataManager::getData(const std::string &name) const MyGUI::IDataStream *DataManager::getData(const std::string &name) const
{ {
std::string fullpath = getDataPath(name); std::string fullpath = getDataPath(name);
std::unique_ptr<boost::filesystem::ifstream> stream; std::unique_ptr<std::ifstream> stream;
stream.reset(new boost::filesystem::ifstream); stream.reset(new std::ifstream);
stream->open(fullpath, std::ios::binary); stream->open(fullpath, std::ios::binary);
if (stream->fail()) if (stream->fail())
{ {
@ -40,7 +40,7 @@ void DataManager::freeData(MyGUI::IDataStream *data)
bool DataManager::isDataExist(const std::string &name) const bool DataManager::isDataExist(const std::string &name) const
{ {
std::string fullpath = mResourcePath + "/" + name; std::string fullpath = mResourcePath + "/" + name;
return boost::filesystem::exists(fullpath); return std::filesystem::exists(fullpath);
} }
const MyGUI::VectorString &DataManager::getDataListNames(const std::string &pattern) const const MyGUI::VectorString &DataManager::getDataListNames(const std::string &pattern) const

@ -8,10 +8,10 @@
#include <osgDB/ReaderWriter> #include <osgDB/ReaderWriter>
#include <osgDB/Registry> #include <osgDB/Registry>
#include <boost/filesystem/fstream.hpp>
#include <boost/filesystem/operations.hpp>
#include <cassert> #include <cassert>
#include <fstream>
#include <filesystem>
#include <iomanip> #include <iomanip>
#include <sstream> #include <sstream>
#include <string> #include <string>
@ -82,10 +82,10 @@ namespace SceneUtil
lastFileName = stream.str(); lastFileName = stream.str();
lastFilePath = screenshotPath + "/" + lastFileName; lastFilePath = screenshotPath + "/" + lastFileName;
} while (boost::filesystem::exists(lastFilePath)); } while (std::filesystem::exists(lastFilePath));
boost::filesystem::ofstream outStream; std::ofstream outStream;
outStream.open(boost::filesystem::path(std::move(lastFilePath)), std::ios::binary); outStream.open(std::filesystem::path(std::move(lastFilePath)), std::ios::binary);
osgDB::ReaderWriter* readerwriter = osgDB::Registry::instance()->getReaderWriterForExtension(screenshotFormat); osgDB::ReaderWriter* readerwriter = osgDB::Registry::instance()->getReaderWriterForExtension(screenshotFormat);
if (!readerwriter) if (!readerwriter)

@ -1,10 +1,10 @@
#include "writescene.hpp" #include "writescene.hpp"
#include <stdexcept> #include <stdexcept>
#include <fstream>
#include <osgDB/Registry> #include <osgDB/Registry>
#include <boost/filesystem/fstream.hpp>
#include "serialize.hpp" #include "serialize.hpp"
@ -16,7 +16,7 @@ void SceneUtil::writeScene(osg::Node *node, const std::string& filename, const s
if (!rw) if (!rw)
throw std::runtime_error("can not find readerwriter for " + format); throw std::runtime_error("can not find readerwriter for " + format);
boost::filesystem::ofstream stream; std::ofstream stream;
stream.open(filename); stream.open(filename);
osg::ref_ptr<osgDB::Options> options = new osgDB::Options; osg::ref_ptr<osgDB::Options> options = new osgDB::Options;

@ -1,16 +1,16 @@
#include "version.hpp" #include "version.hpp"
#include <boost/filesystem/path.hpp> #include <filesystem>
#include <boost/filesystem/fstream.hpp> #include <fstream>
namespace Version namespace Version
{ {
Version getOpenmwVersion(const std::string &resourcePath) Version getOpenmwVersion(const std::string &resourcePath)
{ {
boost::filesystem::path path (resourcePath + "/version"); std::filesystem::path path (resourcePath + "/version");
boost::filesystem::ifstream stream (path); std::ifstream stream (path);
Version v; Version v;
std::getline(stream, v.mVersion); std::getline(stream, v.mVersion);

@ -2,7 +2,7 @@
#include <algorithm> #include <algorithm>
#include <boost/filesystem.hpp> #include <filesystem>
#include <components/debug/debuglog.hpp> #include <components/debug/debuglog.hpp>
@ -20,7 +20,7 @@ namespace VFS
{ {
if (!mBuiltIndex) if (!mBuiltIndex)
{ {
typedef boost::filesystem::recursive_directory_iterator directory_iterator; typedef std::filesystem::recursive_directory_iterator directory_iterator;
directory_iterator end; directory_iterator end;
@ -31,7 +31,7 @@ namespace VFS
for (directory_iterator i (mPath); i != end; ++i) for (directory_iterator i (mPath); i != end; ++i)
{ {
if(boost::filesystem::is_directory (*i)) if(std::filesystem::is_directory (*i))
continue; continue;
std::string proper = i->path ().string (); std::string proper = i->path ().string ();

Loading…
Cancel
Save