10#if defined WIN32 && defined __GLIBCXX__
11#include <ext/stdio_filebuf.h>
14#include <boost/filesystem.hpp>
15#include <boost/filesystem/fstream.hpp>
21using namespace boost::filesystem;
33class path :
public boost::filesystem::path
36 using boost::filesystem::path::path;
40 path&
operator=(boost::filesystem::path
path) { boost::filesystem::path::operator=(std::move(
path));
return *
this; }
41 path&
operator/=(boost::filesystem::path
path) { boost::filesystem::path::operator/=(std::move(
path));
return *
this; }
44 path(
const char* c) : boost::filesystem::
path(c) {}
45 path&
operator=(
const char* c) { boost::filesystem::path::operator=(c);
return *
this; }
46 path&
operator/=(
const char* c) { boost::filesystem::path::operator/=(c);
return *
this; }
47 path&
append(
const char* c) { boost::filesystem::path::append(c);
return *
this; }
50 path(std::string) =
delete;
59 std::string
u8string()
const {
return boost::filesystem::path::string(); }
65 return boost::filesystem::path(
string);
83static inline auto quoted(
const std::string& s)
125 static_assert(std::is_same<path::string_type, std::string>::value,
"PathToString not implemented on this platform");
126 return path.boost::filesystem::path::string();
138 return boost::filesystem::path(
string);
174 void* hFile = (
void*)-1;
194#if defined WIN32 && defined __GLIBCXX__
195 class ifstream :
public std::istream
199 explicit ifstream(
const fs::path& p, std::ios_base::openmode mode = std::ios_base::in) { open(p, mode); }
200 ~ifstream() { close(); }
201 void open(
const fs::path& p, std::ios_base::openmode mode = std::ios_base::in);
202 bool is_open() {
return m_filebuf.is_open(); }
206 __gnu_cxx::stdio_filebuf<char> m_filebuf;
207 FILE* m_file =
nullptr;
209 class ofstream :
public std::ostream
213 explicit ofstream(
const fs::path& p, std::ios_base::openmode mode = std::ios_base::out) { open(p, mode); }
214 ~ofstream() { close(); }
215 void open(
const fs::path& p, std::ios_base::openmode mode = std::ios_base::out);
216 bool is_open() {
return m_filebuf.is_open(); }
220 __gnu_cxx::stdio_filebuf<char> m_filebuf;
221 FILE* m_file =
nullptr;
232template<>
inline void formatValue(std::ostream&,
const char*,
const char*,
int,
const boost::filesystem::path&) =
delete;
233template<>
inline void formatValue(std::ostream&,
const char*,
const char*,
int,
const fs::path&) =
delete;
Path class wrapper to prepare application code for transition from boost::filesystem library to std::...
path & operator=(std::string)=delete
std::string string() const =delete
std::string u8string() const
path & operator/=(std::string)=delete
path & operator=(boost::filesystem::path path)
path & append(std::string)=delete
path & append(const char *c)
path & operator=(const char *c)
path(boost::filesystem::path path)
path & operator/=(boost::filesystem::path path)
path & operator/=(const char *c)
FileLock(FileLock &&)=delete
FileLock(const FileLock &)=delete
Filesystem operations and types.
static path system_complete(const path &p)
static path u8path(const std::string &string)
static auto quoted(const std::string &s)
static bool exists(const path &p)
static std::string PathToString(const path &path)
Convert path object to byte string.
static path PathFromString(const std::string &string)
Convert byte string to path object.
static path operator+(path p1, path p2)
Bridge operations to C stdio.
FILE * fopen(const fs::path &p, const char *mode)
std::string get_filesystem_error_message(const fs::filesystem_error &e)
fs::path AbsPathJoin(const fs::path &base, const fs::path &path)
Helper function for joining two paths.