Skip to content

Commit

Permalink
Merge pull request #514 from erikaldsund/cpp17_filesystem_usage_fixes
Browse files Browse the repository at this point in the history
Cpp17 filesystem usage fixes
  • Loading branch information
The-EDev authored Aug 7, 2022
2 parents 6e7f0fb + b127671 commit 87cf68f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
3 changes: 3 additions & 0 deletions include/crow/settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@
#endif
#if __cplusplus >= 201703L
#define CROW_CAN_USE_CPP17
#if defined(__GNUC__) && __GNUC__ < 8
#define CROW_FILESYSTEM_IS_EXPERIMENTAL
#endif
#endif

#if defined(_MSC_VER)
Expand Down
6 changes: 3 additions & 3 deletions include/crow/utility.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

#include "crow/settings.h"

#ifdef CROW_CAN_USE_CPP17
#if defined(CROW_CAN_USE_CPP17) && !defined(CROW_FILESYSTEM_IS_EXPERIMENTAL)
#include <filesystem>
#endif

Expand Down Expand Up @@ -801,8 +801,8 @@ namespace crow

inline static std::string join_path(std::string path, const std::string& fname)
{
#ifdef CROW_CAN_USE_CPP17
return std::filesystem::path(path) / fname;
#if defined(CROW_CAN_USE_CPP17) && !defined(CROW_FILESYSTEM_IS_EXPERIMENTAL)
return (std::filesystem::path(path) / fname).string();
#else
if (!(path.back() == '/' || path.back() == '\\'))
path += '/';
Expand Down

0 comments on commit 87cf68f

Please sign in to comment.