diff --git a/apps/openmw/mwgui/console.cpp b/apps/openmw/mwgui/console.cpp index aaf36aab59..a382bbeb07 100644 --- a/apps/openmw/mwgui/console.cpp +++ b/apps/openmw/mwgui/console.cpp @@ -4,8 +4,8 @@ #include #include -#include -#include +#include +#include #include #include @@ -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); diff --git a/apps/openmw/mwgui/windowmanagerimp.cpp b/apps/openmw/mwgui/windowmanagerimp.cpp index 95a437ceaa..2a4855f4a3 100644 --- a/apps/openmw/mwgui/windowmanagerimp.cpp +++ b/apps/openmw/mwgui/windowmanagerimp.cpp @@ -3,6 +3,7 @@ #include #include #include +#include #include #include @@ -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(""); diff --git a/components/bsa/bsa_file.cpp b/components/bsa/bsa_file.cpp index e5b730b4c4..02c70d29cb 100644 --- a/components/bsa/bsa_file.cpp +++ b/components/bsa/bsa_file.cpp @@ -23,11 +23,11 @@ #include "bsa_file.hpp" +#include #include - -#include -#include -#include +#include +#include +#include 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); diff --git a/components/bsa/compressedbsafile.cpp b/components/bsa/compressedbsafile.cpp index e4117a0b89..6c0eb47319 100644 --- a/components/bsa/compressedbsafile.cpp +++ b/components/bsa/compressedbsafile.cpp @@ -26,12 +26,12 @@ #include #include +#include +#include #include #include -#include -#include #include #include @@ -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; diff --git a/components/config/launchersettings.cpp b/components/config/launchersettings.cpp index f0d9093993..11ced3c145 100644 --- a/components/config/launchersettings.cpp +++ b/components/config/launchersettings.cpp @@ -7,8 +7,6 @@ #include -#include - #include const char Config::LauncherSettings::sCurrentContentListKey[] = "Profiles/currentprofile"; diff --git a/components/esm3/esmreader.cpp b/components/esm3/esmreader.cpp index 68228a8156..290dfe1a5a 100644 --- a/components/esm3/esmreader.cpp +++ b/components/esm3/esmreader.cpp @@ -1,11 +1,11 @@ #include "esmreader.hpp" -#include #include #include #include #include +#include #include namespace ESM @@ -74,7 +74,7 @@ void ESMReader::resolveParentFileIndices(const std::vector& 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; diff --git a/components/fontloader/fontloader.cpp b/components/fontloader/fontloader.cpp index b67283d01f..657a887cbd 100644 --- a/components/fontloader/fontloader.cpp +++ b/components/fontloader/fontloader.cpp @@ -1,5 +1,6 @@ #include "fontloader.hpp" +#include #include #include #include @@ -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"); diff --git a/components/fontloader/fontloader.hpp b/components/fontloader/fontloader.hpp index 8a46a0069e..ee54e077a5 100644 --- a/components/fontloader/fontloader.hpp +++ b/components/fontloader/fontloader.hpp @@ -1,8 +1,6 @@ #ifndef OPENMW_COMPONENTS_FONTLOADER_H #define OPENMW_COMPONENTS_FONTLOADER_H -#include "boost/filesystem/operations.hpp" - #include #include diff --git a/components/myguiplatform/myguidatamanager.cpp b/components/myguiplatform/myguidatamanager.cpp index 1aa16946a4..62023c8366 100644 --- a/components/myguiplatform/myguidatamanager.cpp +++ b/components/myguiplatform/myguidatamanager.cpp @@ -5,8 +5,8 @@ #include -#include -#include +#include +#include #include @@ -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 stream; - stream.reset(new boost::filesystem::ifstream); + std::unique_ptr 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 diff --git a/components/sceneutil/screencapture.cpp b/components/sceneutil/screencapture.cpp index 99cb535326..97a22e94aa 100644 --- a/components/sceneutil/screencapture.cpp +++ b/components/sceneutil/screencapture.cpp @@ -8,10 +8,10 @@ #include #include -#include -#include #include +#include +#include #include #include #include @@ -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) diff --git a/components/sceneutil/writescene.cpp b/components/sceneutil/writescene.cpp index 6be963ef2e..d243f521c0 100644 --- a/components/sceneutil/writescene.cpp +++ b/components/sceneutil/writescene.cpp @@ -1,10 +1,10 @@ #include "writescene.hpp" #include +#include #include -#include #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 options = new osgDB::Options; diff --git a/components/version/version.cpp b/components/version/version.cpp index fecbdcb3f9..32b8f44ae6 100644 --- a/components/version/version.cpp +++ b/components/version/version.cpp @@ -1,16 +1,16 @@ #include "version.hpp" -#include -#include +#include +#include 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); diff --git a/components/vfs/filesystemarchive.cpp b/components/vfs/filesystemarchive.cpp index 839f84de57..206d9aff0c 100644 --- a/components/vfs/filesystemarchive.cpp +++ b/components/vfs/filesystemarchive.cpp @@ -2,7 +2,7 @@ #include -#include +#include #include @@ -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 ();