--- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -46,7 +46,7 @@ if(COMMAND cmake_policy) cmake_policy(SET CMP0023 NEW) endif(COMMAND cmake_policy) -set(CMAKE_CXX_STANDARD 14) +set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) @@ -171,7 +171,7 @@ if(ENABLE_BOOST_STATIC_LIBS) else(ENABLE_BOOST_STATIC_LIBS) set(Boost_USE_STATIC_LIBS FALSE) endif(ENABLE_BOOST_STATIC_LIBS) -find_package(Boost REQUIRED COMPONENTS filesystem system date_time locale) +find_package(Boost REQUIRED) include_directories(SYSTEM ${Boost_INCLUDE_DIR}) link_directories(${Boost_LIBRARY_DIRS}) @@ -927,7 +927,7 @@ if(WIN32) else() add_executable(supertux2 src/main.cpp) endif(WIN32) -target_link_libraries(supertux2 supertux2_lib Boost::filesystem Boost::locale) +target_link_libraries(supertux2 supertux2_lib) set_target_properties(supertux2_lib PROPERTIES OUTPUT_NAME supertux2_lib) set_target_properties(supertux2_lib PROPERTIES COMPILE_FLAGS "${SUPERTUX2_EXTRA_WARNING_FLAGS}") --- a/src/supertux/main.cpp +++ b/src/supertux/main.cpp @@ -22,7 +22,7 @@ #include #include -#include +#include #include #include #include @@ -208,7 +208,7 @@ void PhysfsSubsystem::find_datadir() con { datadir = BUILD_DATA_DIR; // Add config dir for supplemental files - PHYSFS_mount(boost::filesystem::canonical(BUILD_CONFIG_DATA_DIR).string().c_str(), nullptr, 1); + PHYSFS_mount(std::filesystem::canonical(BUILD_CONFIG_DATA_DIR).string().c_str(), nullptr, 1); } else { @@ -219,7 +219,7 @@ void PhysfsSubsystem::find_datadir() con } } - if (!PHYSFS_mount(boost::filesystem::canonical(datadir).string().c_str(), nullptr, 1)) + if (!PHYSFS_mount(std::filesystem::canonical(datadir).string().c_str(), nullptr, 1)) { log_warning << "Couldn't add '" << datadir << "' to physfs searchpath: " << PHYSFS_getLastErrorCode() << std::endl; } @@ -263,20 +263,20 @@ std::string olduserdir = FileSystem::joi std::string olduserdir = FileSystem::join(physfs_userdir, "." PACKAGE_NAME); #endif if (FileSystem::is_directory(olduserdir)) { - boost::filesystem::path olduserpath(olduserdir); - boost::filesystem::path userpath(userdir); + std::filesystem::path olduserpath(olduserdir); + std::filesystem::path userpath(userdir); - boost::filesystem::directory_iterator end_itr; + std::filesystem::directory_iterator end_itr; bool success = true; // cycle through the directory - for (boost::filesystem::directory_iterator itr(olduserpath); itr != end_itr; ++itr) { + for (std::filesystem::directory_iterator itr(olduserpath); itr != end_itr; ++itr) { try { - boost::filesystem::rename(itr->path().string().c_str(), userpath / itr->path().filename()); + std::filesystem::rename(itr->path().string().c_str(), userpath / itr->path().filename()); } - catch (const boost::filesystem::filesystem_error& err) + catch (const std::filesystem::filesystem_error& err) { success = false; log_warning << "Failed to move contents of config directory: " << err.what() << std::endl; @@ -285,9 +285,9 @@ if (FileSystem::is_directory(olduserdir) if (success) { try { - boost::filesystem::remove_all(olduserpath); + std::filesystem::remove_all(olduserpath); } - catch (const boost::filesystem::filesystem_error& err) + catch (const std::filesystem::filesystem_error& err) { success = false; log_warning << "Failed to remove old config directory: " << err.what(); @@ -610,8 +610,8 @@ Main::run(int argc, char** argv) try { std::locale::global(boost::locale::generator().generate("")); - // Make boost.filesystem use it - boost::filesystem::path::imbue(std::locale()); + // Make std.filesystem use it + std::filesystem::path::imbue(std::locale()); } catch(const std::runtime_error& err) { --- a/src/util/file_system.cpp +++ b/src/util/file_system.cpp @@ -16,7 +16,7 @@ #include "util/file_system.hpp" -#include +#include #include #include #include @@ -38,14 +38,14 @@ #include "util/log.hpp" #include "util/string_util.hpp" -namespace fs = boost::filesystem; +namespace fs = std::filesystem; namespace FileSystem { bool exists(const std::string& path) { fs::path location(path); - boost::system::error_code ec; + std::error_code ec; // If we get an error (such as "Permission denied"), then ignore it // and pretend that the path doesn't exist.