mirror of
https://github.com/oxen-io/oxen-core.git
synced 2023-12-14 02:22:56 +01:00
1dd98f3dae
Converts all use of boost::filesystem to std::filesystem. For macos and potentially other exotic systems where std::filesystem isn't available, we use ghc::filesystem instead (which is a drop-in replacement for std::filesystem, unlike boost::filesystem). This also greatly changes how we handle filenames internally by holding them in filesystem::path objects as soon as possible (using fs::u8path()), rather than strings, which avoids a ton of issues around unicode filenames. As a result this lets us drop the boost::locale dependency on Windows along with a bunch of messy Windows ifdef code, and avoids the need for doing gross boost locale codecvt calls.
25 lines
799 B
C++
25 lines
799 B
C++
#pragma once
|
|
|
|
// Header to load the std::filesystem namespace (or something compatible with it) as the `fs`
|
|
// namespace. For older compilers (which generally just means macos before pre-10.15) we can't
|
|
// actually use std::filesystem because Apple's libc++ developers are incompetent.
|
|
//
|
|
// Also provides fs::ifstream/ofstream/fstream which will be either directly
|
|
// std::ifstream/ofstream/fstream (if under a proper C++17), or a simple wrapper around them that
|
|
// supports a C++17-style fs::path filename argument.
|
|
|
|
#ifndef USE_GHC_FILESYSTEM
|
|
|
|
#include <filesystem>
|
|
namespace fs {
|
|
using namespace std::filesystem;
|
|
using ifstream = std::ifstream;
|
|
using ofstream = std::ofstream;
|
|
using fstream = std::fstream;
|
|
}
|
|
#else
|
|
|
|
#include <ghc/filesystem.hpp>
|
|
namespace fs = ghc::filesystem;
|
|
|
|
#endif
|