Remove even more of boost::filesystem

fix/shrink_builds
jvoisin 3 years ago committed by Petr Mikheev
parent 59e7f61205
commit 4e4debb1cb

@ -1,8 +1,8 @@
#include "importer.hpp"
#include <iomanip>
#include <boost/filesystem/fstream.hpp>
#include <filesystem>
#include <fstream>
#include <osgDB/ReadFile>
#include <osg/ImageUtils>
@ -345,7 +345,7 @@ namespace ESSImport
writer.setFormat (ESM::SavedGame::sCurrentFormat);
boost::filesystem::ofstream stream(boost::filesystem::path(mOutFile), std::ios::out | std::ios::binary);
std::ofstream stream(std::filesystem::path(mOutFile), std::ios::out | std::ios::binary);
// all unused
writer.setVersion(0);
writer.setType(0);

@ -3,6 +3,7 @@
#include <iomanip>
#include <chrono>
#include <thread>
#include <filesystem>
#include <boost/filesystem/fstream.hpp>
@ -684,7 +685,7 @@ void OMW::Engine::createWindow()
void OMW::Engine::setWindowIcon()
{
boost::filesystem::ifstream windowIconStream;
std::ifstream windowIconStream;
std::string windowIcon = (mResDir / "mygui" / "openmw.png").string();
windowIconStream.open(windowIcon, std::ios_base::in | std::ios_base::binary);
if (windowIconStream.fail())
@ -759,13 +760,13 @@ void OMW::Engine::prepareEngine()
// showing a loading screen and keeping the window responsive while doing so
std::string keybinderUser = (mCfgMgr.getUserConfigPath() / "input_v3.xml").string();
bool keybinderUserExists = boost::filesystem::exists(keybinderUser);
bool keybinderUserExists = std::filesystem::exists(keybinderUser);
if(!keybinderUserExists)
{
std::string input2 = (mCfgMgr.getUserConfigPath() / "input_v2.xml").string();
if(boost::filesystem::exists(input2)) {
boost::filesystem::copy_file(input2, keybinderUser);
keybinderUserExists = boost::filesystem::exists(keybinderUser);
if(std::filesystem::exists(input2)) {
std::filesystem::copy_file(input2, keybinderUser);
keybinderUserExists = std::filesystem::exists(keybinderUser);
Log(Debug::Info) << "Loading keybindings file: " << keybinderUser;
}
}
@ -777,13 +778,13 @@ void OMW::Engine::prepareEngine()
const std::string globaldefault = mCfgMgr.getGlobalPath().string() + "/gamecontrollerdb.txt";
std::string userGameControllerdb;
if (boost::filesystem::exists(userdefault))
if (std::filesystem::exists(userdefault))
userGameControllerdb = userdefault;
std::string gameControllerdb;
if (boost::filesystem::exists(localdefault))
if (std::filesystem::exists(localdefault))
gameControllerdb = localdefault;
else if (boost::filesystem::exists(globaldefault))
else if (std::filesystem::exists(globaldefault))
gameControllerdb = globaldefault;
//else if it doesn't exist, pass in an empty string

@ -14,8 +14,7 @@
#include <osgDB/ReadFile>
#include <boost/filesystem/path.hpp>
#include <boost/filesystem/fstream.hpp>
#include <fstream>
#include <osgUtil/IncrementalCompileOperation>
#include <osgUtil/CullVisitor>
@ -242,8 +241,7 @@ private:
osg::ref_ptr<osg::Image> readPngImage (const std::string& file)
{
// use boost in favor of osgDB::readImage, to handle utf-8 path issues on Windows
boost::filesystem::ifstream inStream;
std::ifstream inStream;
inStream.open(file, std::ios_base::in | std::ios_base::binary);
if (inStream.fail())
Log(Debug::Error) << "Error: Failed to open " << file;

@ -1,4 +1,5 @@
#include <stdio.h>
#include <cstring>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
@ -9,6 +10,8 @@
#include <string.h>
#include <errno.h>
#include <limits.h>
#include <fstream>
#include <filesystem>
#include <pthread.h>
#include <stdbool.h>
@ -16,11 +19,6 @@
#include <components/debug/debuglog.hpp>
#include <boost/filesystem/fstream.hpp>
#include <boost/filesystem/operations.hpp>
namespace bfs = boost::filesystem;
#include <SDL_messagebox.h>
#ifdef __linux__
@ -501,10 +499,10 @@ int crashCatcherInstallHandlers(int argc, char **argv, int num_signals, int *sig
static bool is_debugger_present()
{
#if defined (__linux__)
bfs::path procstatus = bfs::path("/proc/self/status");
if (bfs::exists(procstatus))
std::filesystem::path procstatus = std::filesystem::path("/proc/self/status");
if (std::filesystem::exists(procstatus))
{
bfs::ifstream file((procstatus));
std::ifstream file((procstatus));
while (!file.eof())
{
std::string word;

@ -3,6 +3,8 @@
#include <chrono>
#include <memory>
#include <functional>
#include <fstream>
#include <filesystem>
#include <components/crashcatcher/crashcatcher.hpp>
@ -142,7 +144,7 @@ namespace Debug
static std::unique_ptr<std::ostream> rawStdout = nullptr;
static std::unique_ptr<std::ostream> rawStderr = nullptr;
static std::unique_ptr<std::mutex> rawStderrMutex = nullptr;
static boost::filesystem::ofstream logfile;
static std::ofstream logfile;
#if defined(_WIN32) && defined(_DEBUG)
static boost::iostreams::stream_buffer<Debug::DebugOutput> sb;
@ -176,7 +178,7 @@ void setupLogging(const std::string& logDir, const std::string& appName, std::io
std::cerr.rdbuf(&sb);
#else
const std::string logName = Misc::StringUtils::lowerCase(appName) + ".log";
logfile.open(boost::filesystem::path(logDir) / logName, mode);
logfile.open(std::filesystem::path(logDir) / logName, mode);
coutsb.open(Debug::Tee(logfile, *rawStdout));
cerrsb.open(Debug::Tee(logfile, *rawStderr));

@ -6,8 +6,8 @@
#include <DetourNavMesh.h>
#include <boost/filesystem.hpp>
#include <boost/filesystem/fstream.hpp>
#include <filesystem>
#include <fstream>
namespace DetourNavigator
{
@ -15,7 +15,7 @@ namespace DetourNavigator
const std::string& revision, const RecastSettings& settings)
{
const auto path = pathPrefix + "recastmesh" + revision + ".obj";
boost::filesystem::ofstream file(boost::filesystem::path(path), std::ios::out);
std::ofstream file(std::filesystem::path(path), std::ios::out);
if (!file.is_open())
throw NavigatorException("Open file failed: " + path);
file.exceptions(std::ios::failbit | std::ios::badbit);
@ -62,7 +62,7 @@ namespace DetourNavigator
};
const auto path = pathPrefix + "all_tiles_navmesh" + revision + ".bin";
boost::filesystem::ofstream file(boost::filesystem::path(path), std::ios::out | std::ios::binary);
std::ofstream file(std::filesystem::path(path), std::ios::out | std::ios::binary);
if (!file.is_open())
throw NavigatorException("Open file failed: " + path);
file.exceptions(std::ios::failbit | std::ios::badbit);

@ -31,6 +31,7 @@
#include <cassert>
#include <stdexcept>
#include <unordered_map>
#include <filesystem>
#include <iostream> // for debugging
#include <sstream> // for debugging
#include <iomanip> // for debugging
@ -46,8 +47,6 @@
#include <boost/iostreams/filtering_streambuf.hpp>
#include <boost/iostreams/copy.hpp>
#include <boost/algorithm/string.hpp>
#include <boost/filesystem/path.hpp>
#include <boost/filesystem/operations.hpp>
#include <components/bsa/memorystream.hpp>
@ -192,7 +191,7 @@ void Reader::buildLStringIndex()
if ((mHeader.mFlags & Rec_ESM) == 0 || (mHeader.mFlags & Rec_Localized) == 0)
return;
boost::filesystem::path p(mCtx.filename);
std::filesystem::path p(mCtx.filename);
std::string filename = p.stem().filename().string();
buildLStringIndex("Strings/" + filename + "_English.STRINGS", Type_Strings);

@ -20,6 +20,7 @@
#include <components/misc/stringops.hpp>
#include <algorithm>
#include <filesystem>
#include <cstddef>
#include <map>
#include <set>
@ -222,7 +223,7 @@ namespace EsmLoader
for (std::size_t i = 0; i < contentFiles.size(); ++i)
{
const std::string &file = contentFiles[i];
const std::string extension = Misc::StringUtils::lowerCase(boost::filesystem::path(file).extension().string());
const std::string extension = Misc::StringUtils::lowerCase(std::filesystem::path(file).extension().string());
if (supportedFormats.find(extension) == supportedFormats.end())
{

@ -5,7 +5,8 @@
#include <components/debug/debuglog.hpp>
#include <components/misc/stringops.hpp>
#include <boost/filesystem/fstream.hpp>
#include <fstream>
#include <filesystem>
#include <Base64.h>
@ -13,8 +14,8 @@ void Settings::SettingsFileParser::loadSettingsFile(const std::string& file, Cat
bool base64Encoded, bool overrideExisting)
{
mFile = file;
boost::filesystem::ifstream fstream;
fstream.open(boost::filesystem::path(file));
std::ifstream fstream;
fstream.open(std::filesystem::path(file));
auto stream = std::ref<std::istream>(fstream);
std::istringstream decodedStream;
@ -106,8 +107,8 @@ void Settings::SettingsFileParser::saveSettingsFile(const std::string& file, con
// Open the existing settings.cfg file to copy comments. This might not be the same file
// as the output file if we're copying the setting from the default settings.cfg for the
// first time. A minor change in API to pass the source file might be in order here.
boost::filesystem::ifstream istream;
boost::filesystem::path ipath(file);
std::ifstream istream;
std::filesystem::path ipath(file);
istream.open(ipath);
// Create a new string stream to write the current settings to. It's likely that the
@ -305,7 +306,7 @@ void Settings::SettingsFileParser::saveSettingsFile(const std::string& file, con
// Now install the newly written file in the requested place.
if (changed) {
Log(Debug::Info) << "Updating settings file: " << ipath;
boost::filesystem::ofstream ofstream;
std::ofstream ofstream;
ofstream.open(ipath);
ofstream << ostream.rdbuf();
ofstream.close();

Loading…
Cancel
Save