From 65eead0079b84988fd49c317bb4e533a1f21d6a0 Mon Sep 17 00:00:00 2001 From: frank Date: Thu, 18 Apr 2024 00:01:23 -0400 Subject: [PATCH] use experimental filesystem path for Ubuntu 18.04 --- src/Configuration.hpp | 10 +++++----- src/Game.cpp | 2 +- src/filesystem.hpp | 12 ++++++------ 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/Configuration.hpp b/src/Configuration.hpp index 4b22563..1d931f8 100644 --- a/src/Configuration.hpp +++ b/src/Configuration.hpp @@ -32,7 +32,7 @@ class Configuration : public Node private: Animation auto_refresher = Animation(std::bind(&Configuration::refresh, this)); - std::filesystem::file_time_type config_modification_time = std::filesystem::file_time_type::clock::now(); + fs::file_time_type config_modification_time = fs::file_time_type::clock::now(); std::vector files_to_refresh; /*! @@ -267,11 +267,11 @@ namespace glm } /* Extend std::filesystem so nlohmann::json can read and write std::filesystem::path */ -// #if defined(__MINGW32__) -// namespace std::experimental::filesystem -// #else +#if defined(__UBUNTU18__) +namespace std::experimental::filesystem +#else namespace std::filesystem -// #endif +#endif { template void to_json(nlohmann::json& j, const path& p) diff --git a/src/Game.cpp b/src/Game.cpp index 61fd18d..059c446 100644 --- a/src/Game.cpp +++ b/src/Game.cpp @@ -53,7 +53,7 @@ Game::Game(std::initializer_list configuration_merge) /* Log the current working directory as seen by std::filesystem */ std::ostringstream log_message; - log_message << "Current path as seen by std::filesystem is " << std::filesystem::current_path(); + log_message << "Current path as seen by std::filesystem is " << fs::current_path(); sb::Log::log(log_message); /* Load the key mappings into the input manager object */ diff --git a/src/filesystem.hpp b/src/filesystem.hpp index 42ed009..289921a 100644 --- a/src/filesystem.hpp +++ b/src/filesystem.hpp @@ -1,10 +1,10 @@ #pragma once -/* MinGW filesystem library is in another location */ -// #if defined(__MINGW32__) -// #include -// namespace fs = std::experimental::filesystem; -// #else +/* C++17's filesystem library is still experimental in Ubuntu 18.04's clang-10 */ +#if defined(__UBUNTU18__) +#include +namespace fs = std::experimental::filesystem; +#else #include namespace fs = std::filesystem; -// #endif +#endif