Replace boost::filesystem std::filyestem

Bumping the minimum version of macOS to 10.15 for spidermonky [1] also
allows us to use std::filesystem instead of boosts implementation.

[1] f14a98e26f

Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
This commit is contained in:
Ralph Sennhauser 2025-10-20 13:45:11 +02:00
parent 618ffc7bf9
commit eba8439295
No known key found for this signature in database
5 changed files with 14 additions and 33 deletions

View file

@ -224,21 +224,6 @@ extern_lib_defs = {
externalincludedirs { "/usr/local/include" }
end
end,
link_settings = function()
if os.istarget("windows") or os.istarget("macosx") then
if os.istarget("windows") then
defines { 'BOOST_LIB_TOOLSET="vc143"' }
end
add_default_lib_paths("boost")
end
add_default_links({
-- The following are not strictly link dependencies on all systems, but
-- are included for compatibility with different versions of Boost
android_names = { "boost_filesystem-gcc-mt" },
unix_names = { os.findlib("boost_filesystem-mt") and "boost_filesystem-mt" or "boost_filesystem" },
osx_names = { "boost_filesystem" },
})
end,
},
comsuppw = {
link_settings = function()

View file

@ -43,9 +43,9 @@
#include <algorithm>
#include <array>
#include <boost/filesystem.hpp>
#include <boost/iterator/iterator_facade.hpp>
#include <chrono>
#include <filesystem>
#include <iterator>
#include <set>
#include <sstream>
@ -792,11 +792,11 @@ public:
*/
CTextureConverter::Settings GetConverterSettings(const CTexturePtr& texture)
{
boost::filesystem::path srcPath = texture->m_Properties.m_Path.string();
std::filesystem::path srcPath = texture->m_Properties.m_Path.string();
std::vector<CTextureConverter::SettingsFile*> files;
VfsPath p;
for (boost::filesystem::path::iterator it = srcPath.begin(); it != srcPath.end(); ++it)
for (std::filesystem::path::iterator it = srcPath.begin(); it != srcPath.end(); ++it)
{
VfsPath settingsPath = p / "textures.xml";
m_HotloadFiles[settingsPath].insert(texture);

View file

@ -32,10 +32,10 @@
#include "lib/sysdep/filesystem.h"
#include "lib/sysdep/os.h"
#include <boost/filesystem.hpp>
#include <boost/version.hpp>
#include <cerrno>
#include <cstring>
#include <filesystem>
#include <memory>
#include <string>
@ -217,9 +217,9 @@ Status RenameFile(const OsPath& path, const OsPath& newPath)
try
{
boost::filesystem::rename(boost::filesystem::path(path.string()), boost::filesystem::path(newPath.string()));
std::filesystem::rename(std::filesystem::path(path.string()), std::filesystem::path(newPath.string()));
}
catch (boost::filesystem::filesystem_error& err)
catch (std::filesystem::filesystem_error& err)
{
debug_printf("RenameFile: failed to rename %s to %s.\n%s\n", path.string8().c_str(), path.string8().c_str(), err.what());
return ERR::EXCEPTION;
@ -237,15 +237,11 @@ Status CopyFile(const OsPath& path, const OsPath& newPath, bool override_if_exis
try
{
if(override_if_exists)
#if BOOST_VERSION >=107400
boost::filesystem::copy_file(boost::filesystem::path(path.string()), boost::filesystem::path(newPath.string()), boost::filesystem::copy_options::overwrite_existing);
#else
boost::filesystem::copy_file(boost::filesystem::path(path.string()), boost::filesystem::path(newPath.string()), boost::filesystem::copy_option::overwrite_if_exists);
#endif
std::filesystem::copy_file(std::filesystem::path(path.string()), std::filesystem::path(newPath.string()), std::filesystem::copy_options::overwrite_existing);
else
boost::filesystem::copy_file(boost::filesystem::path(path.string()), boost::filesystem::path(newPath.string()));
std::filesystem::copy_file(std::filesystem::path(path.string()), std::filesystem::path(newPath.string()));
}
catch(boost::filesystem::filesystem_error& err)
catch(std::filesystem::filesystem_error& err)
{
debug_printf("CopyFile: failed to copy %s to %s.\n%s\n", path.string8().c_str(), path.string8().c_str(), err.what());
return ERR::EXCEPTION;

View file

@ -31,7 +31,7 @@
#include "scriptinterface/ScriptRequest.h"
#include "simulation2/system/InterfaceScripted.h"
#include <boost/filesystem.hpp>
#include <filesystem>
#include <iterator>
#include <js/Array.h>
#include <js/PropertyAndElement.h>
@ -72,8 +72,8 @@ public:
ScriptRequest rq(self->m_ScriptInterface);
// Extract the 3rd component of the path (i.e. the directory after simulation/ai/)
boost::filesystem::path components = pathname.string();
boost::filesystem::path::iterator it = components.begin();
std::filesystem::path components = pathname.string();
std::filesystem::path::iterator it = components.begin();
std::advance(it, 2);
std::wstring dirname = it->wstring();

View file

@ -24,7 +24,7 @@
#include "tinygettext/unix_file_system.hpp"
#include <boost/filesystem.hpp>
#include <filesystem>
#include <fstream>
#include <stdlib.h>
@ -38,7 +38,7 @@ std::vector<std::string>
UnixFileSystem::open_directory(const std::string& pathname)
{
std::vector<std::string> files;
for(auto const& p : boost::filesystem::directory_iterator(pathname))
for(auto const& p : std::filesystem::directory_iterator(pathname))
{
files.push_back(p.path().filename().string());
}