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

@ -3,6 +3,7 @@
#include <algorithm>
#include <cassert>
#include <chrono>
#include <filesystem>
#include <thread>
#include <osgViewer/Viewer>
@ -195,7 +196,7 @@ namespace MWGui
{
mScalingFactor = std::clamp(Settings::Manager::getFloat("scaling factor", "GUI"), 0.5f, 8.f);
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->initialise("");

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

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

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

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

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

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

@ -5,8 +5,8 @@
#include <MyGUI_DataFileStream.h>
#include <boost/filesystem/operations.hpp>
#include <boost/filesystem/fstream.hpp>
#include <filesystem>
#include <fstream>
#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
{
std::string fullpath = getDataPath(name);
std::unique_ptr<boost::filesystem::ifstream> stream;
stream.reset(new boost::filesystem::ifstream);
std::unique_ptr<std::ifstream> stream;
stream.reset(new std::ifstream);
stream->open(fullpath, std::ios::binary);
if (stream->fail())
{
@ -40,7 +40,7 @@ void DataManager::freeData(MyGUI::IDataStream *data)
bool DataManager::isDataExist(const std::string &name) const
{
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

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

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

@ -1,16 +1,16 @@
#include "version.hpp"
#include <boost/filesystem/path.hpp>
#include <boost/filesystem/fstream.hpp>
#include <filesystem>
#include <fstream>
namespace Version
{
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;
std::getline(stream, v.mVersion);

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

Loading…
Cancel
Save