build: use experimental::fs over boost::fs

This commit is contained in:
Danny Robson 2016-10-07 19:48:42 +11:00
parent ea5c3befe4
commit 48364cd227
17 changed files with 37 additions and 37 deletions

View File

@ -101,7 +101,7 @@ NC_DEBUGGING
CHECK_RAGEL([ip.cpp]) CHECK_RAGEL([ip.cpp])
NC_BOOST([1.53], [system filesystem thread]) NC_BOOST([1.53], [system thread])
AC_SUBST(BOOST_CPPFLAGS) AC_SUBST(BOOST_CPPFLAGS)
AC_SUBST(BOOST_LDFLAGS) AC_SUBST(BOOST_LDFLAGS)

12
exe.cpp
View File

@ -31,7 +31,7 @@
#include <stdexcept> #include <stdexcept>
#include <vector> #include <vector>
boost::filesystem::path std::experimental::filesystem::path
util::image_path (void) { util::image_path (void) {
static const char PROC_SELF[] = "/proc/self/exe"; static const char PROC_SELF[] = "/proc/self/exe";
@ -50,7 +50,7 @@ retry:
goto retry; goto retry;
} }
return boost::filesystem::path (resolved.data (), resolved.data () + written); return std::experimental::filesystem::path (resolved.data (), resolved.data () + written);
} }
#elif defined(PLATFORM_FREEBSD) #elif defined(PLATFORM_FREEBSD)
@ -61,7 +61,7 @@ retry:
#include <sys/types.h> #include <sys/types.h>
#include <sys/sysctl.h> #include <sys/sysctl.h>
boost::filesystem::path std::experimental::filesystem::path
util::image_path (void) util::image_path (void)
{ {
int name[] = { int name[] = {
@ -77,7 +77,7 @@ util::image_path (void)
auto err = sysctl (name, elems (name), data, &len, nullptr, 0); auto err = sysctl (name, elems (name), data, &len, nullptr, 0);
errno_error::try_code (err); errno_error::try_code (err);
return boost::filesystem::path (std::cbegin (data), std::cbegin (data) + len); return std::experimental::filesystem::path (std::cbegin (data), std::cbegin (data) + len);
} }
#elif defined(PLATFORM_WIN32) #elif defined(PLATFORM_WIN32)
@ -86,7 +86,7 @@ util::image_path (void)
#include <windows.h> #include <windows.h>
boost::filesystem::path std::experimental::filesystem::path
util::image_path (void) { util::image_path (void) {
std::vector<char> resolved (256); std::vector<char> resolved (256);
@ -100,7 +100,7 @@ retry:
goto retry; goto retry;
} }
return boost::filesystem::path (resolved.data (), resolved.data () + written); return std::experimental::filesystem::path (resolved.data (), resolved.data () + written);
} }
#else #else

View File

@ -17,10 +17,10 @@
#ifndef __UTIL_EXE_HPP #ifndef __UTIL_EXE_HPP
#define __UTIL_EXE_HPP #define __UTIL_EXE_HPP
#include <boost/filesystem/path.hpp> #include <experimental/filesystem>
namespace util { namespace util {
boost::filesystem::path image_path (void); std::experimental::filesystem::path image_path (void);
} }
#endif #endif

4
io.cpp
View File

@ -27,7 +27,7 @@
#include <sys/types.h> #include <sys/types.h>
#include <unistd.h> #include <unistd.h>
#include <boost/filesystem.hpp> #include <experimental/filesystem>
#include <stdexcept> #include <stdexcept>
@ -201,7 +201,7 @@ scoped_cwd::~scoped_cwd ()
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
path_error::path_error (const boost::filesystem::path &_path): path_error::path_error (const std::experimental::filesystem::path &_path):
runtime_error (format::render ("Unknown path: %!", m_path)), runtime_error (format::render ("Unknown path: %!", m_path)),
m_path (_path) m_path (_path)
{ ; } { ; }

6
io.hpp
View File

@ -27,7 +27,7 @@
#include <cstdio> #include <cstdio>
#include <cstdint> #include <cstdint>
#include <memory> #include <memory>
#include <boost/filesystem/path.hpp> #include <experimental/filesystem>
#ifdef PLATFORM_WIN32 #ifdef PLATFORM_WIN32
#include <windows.h> #include <windows.h>
@ -104,12 +104,12 @@ namespace util {
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
class path_error : public std::runtime_error { class path_error : public std::runtime_error {
public: public:
path_error (const boost::filesystem::path &path); path_error (const std::experimental::filesystem::path &path);
const char* path (void) const noexcept; const char* path (void) const noexcept;
private: private:
const boost::filesystem::path m_path; const std::experimental::filesystem::path m_path;
}; };
class stream_error : public std::exception { class stream_error : public std::exception {

View File

@ -118,7 +118,7 @@ mapped_file::mapped_file (::util::win32::handle &&src,
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
mapped_file::mapped_file (const boost::filesystem::path &path, mapped_file::mapped_file (const std::experimental::filesystem::path &path,
int fflags, int fflags,
int mflags): int mflags):
mapped_file ( mapped_file (

View File

@ -22,7 +22,7 @@
#include "./view.hpp" #include "./view.hpp"
#include <cstdint> #include <cstdint>
#include <boost/filesystem/path.hpp> #include <experimental/filesystem>
#include <windows.h> #include <windows.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <sys/types.h> #include <sys/types.h>
@ -57,7 +57,7 @@ namespace util {
mapped_file (::util::win32::handle &&, mapped_file (::util::win32::handle &&,
int fflags = O_RDONLY, int fflags = O_RDONLY,
int mflags = PROT_READ); int mflags = PROT_READ);
mapped_file (const boost::filesystem::path &path, mapped_file (const std::experimental::filesystem::path &path,
int fflags = O_RDONLY, int fflags = O_RDONLY,
int mflags = PROT_READ); int mflags = PROT_READ);
mapped_file (const util::fd&, mapped_file (const util::fd&,

View File

@ -17,7 +17,7 @@
#ifndef __UTIL_JSON_FLAT_HPP #ifndef __UTIL_JSON_FLAT_HPP
#define __UTIL_JSON_FLAT_HPP #define __UTIL_JSON_FLAT_HPP
#include <boost/filesystem/path.hpp> #include <experimental/filesystem>
#include <ostream> #include <ostream>
#include "../view.hpp" #include "../view.hpp"

View File

@ -528,7 +528,7 @@ json::schema::validate (json::tree::node &data,
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void void
json::schema::validate (json::tree::node &data, json::schema::validate (json::tree::node &data,
const boost::filesystem::path &schema_path) const std::experimental::filesystem::path &schema_path)
{ {
const util::mapped_file schema_data (schema_path.string ().c_str ()); const util::mapped_file schema_data (schema_path.string ().c_str ());
auto schema_object = json::tree::parse (schema_data.as_view<char> ()); auto schema_object = json::tree::parse (schema_data.as_view<char> ());

View File

@ -20,7 +20,7 @@
#include "./fwd.hpp" #include "./fwd.hpp"
#include <memory> #include <memory>
#include <boost/filesystem/path.hpp> #include <experimental/filesystem>
namespace json { namespace schema { namespace json { namespace schema {
// Validate the json tree using the provide schema object or path. // Validate the json tree using the provide schema object or path.
@ -29,7 +29,7 @@ namespace json { namespace schema {
// of validation. If a value is not present but the schema specifies a // of validation. If a value is not present but the schema specifies a
// default, it will be realised in the data object. // default, it will be realised in the data object.
void validate (json::tree::node &data, const json::tree::object &schema); void validate (json::tree::node &data, const json::tree::object &schema);
void validate (json::tree::node &data, const boost::filesystem::path &schema); void validate (json::tree::node &data, const std::experimental::filesystem::path &schema);
} } } }
#endif #endif

View File

@ -248,7 +248,7 @@ MAP(
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
std::unique_ptr<json::tree::node> std::unique_ptr<json::tree::node>
json::tree::parse (const boost::filesystem::path &src) json::tree::parse (const std::experimental::filesystem::path &src)
{ {
const util::mapped_file data (src.string ().c_str ()); const util::mapped_file data (src.string ().c_str ());
return parse (data.as_view<char> ()); return parse (data.as_view<char> ());

View File

@ -29,7 +29,7 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include <boost/filesystem/path.hpp> #include <experimental/filesystem>
namespace json { namespace tree { namespace json { namespace tree {
@ -48,7 +48,7 @@ namespace json { namespace tree {
parse (util::view<T> data); parse (util::view<T> data);
std::unique_ptr<node> std::unique_ptr<node>
parse (const boost::filesystem::path &); parse (const std::experimental::filesystem::path &);
extern void write (const json::tree::node&, std::ostream&); extern void write (const json::tree::node&, std::ostream&);

2
m4/nc

@ -1 +1 @@
Subproject commit 006f69779160a490786399b1af6a7d1e251cd15c Subproject commit 597459d7e6dd9d8994740a863231eac49cc9bd56

View File

@ -18,14 +18,14 @@
#include "./string.hpp" #include "./string.hpp"
#include <boost/filesystem.hpp> #include <experimental/filesystem>
#include <cstdlib> #include <cstdlib>
#include <stdexcept> #include <stdexcept>
using util::term::csi::graphics; using util::term::csi::graphics;
static const boost::filesystem::path DEFAULT_SEARCH_DIR = "/usr/share/terminfo"; static const std::experimental::filesystem::path DEFAULT_SEARCH_DIR = "/usr/share/terminfo";
constexpr char util::term::csi::code::CSI; constexpr char util::term::csi::code::CSI;
@ -37,14 +37,14 @@ const graphics graphics::RESET (0);
// //
// throws an exception if not found // throws an exception if not found
static static
boost::filesystem::path std::experimental::filesystem::path
find_terminfo_path (const boost::filesystem::path &dir, find_terminfo_path (const std::experimental::filesystem::path &dir,
const std::string &key) const std::string &key)
{ {
const char letter[2] = { key[0], '\0' }; const char letter[2] = { key[0], '\0' };
auto candidate = dir / letter / key; auto candidate = dir / letter / key;
if (!boost::filesystem::is_directory (candidate)) if (!std::experimental::filesystem::is_directory (candidate))
throw std::runtime_error ("path not found"); throw std::runtime_error ("path not found");
return candidate; return candidate;
@ -56,7 +56,7 @@ find_terminfo_path (const boost::filesystem::path &dir,
// //
// throws an exception if not found // throws an exception if not found
static static
boost::filesystem::path std::experimental::filesystem::path
find_terminfo_path (const std::string &key) find_terminfo_path (const std::string &key)
{ {
// check if the path is explicitly listed. must not fall through. // check if the path is explicitly listed. must not fall through.
@ -66,7 +66,7 @@ find_terminfo_path (const std::string &key)
// check if we have a path at $HOME. falls through. // check if we have a path at $HOME. falls through.
if (const char *home = getenv ("HOME")) { if (const char *home = getenv ("HOME")) {
boost::filesystem::path HOME (home); std::experimental::filesystem::path HOME (home);
try { try {
return find_terminfo_path (HOME / ".terminfo", key); return find_terminfo_path (HOME / ".terminfo", key);
} catch (...) { } } catch (...) { }
@ -81,7 +81,7 @@ find_terminfo_path (const std::string &key)
return find_terminfo_path ( return find_terminfo_path (
i.empty () ? i.empty () ?
DEFAULT_SEARCH_DIR : DEFAULT_SEARCH_DIR :
boost::filesystem::path (i.cbegin (), i.cend ()), key std::experimental::filesystem::path (i.cbegin (), i.cend ()), key
); );
} catch (...) { } } catch (...) { }
} }

View File

@ -21,7 +21,7 @@
#include <cstdlib> #include <cstdlib>
#include <iostream> #include <iostream>
#include <boost/filesystem/path.hpp> #include <experimental/filesystem>
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////

View File

@ -22,11 +22,11 @@
#include "io.hpp" #include "io.hpp"
#include <boost/filesystem.hpp> #include <experimental/filesystem>
#include <iostream> #include <iostream>
namespace fs = boost::filesystem; namespace fs = std::experimental::filesystem;
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////

View File

@ -21,7 +21,7 @@
#include <iostream> #include <iostream>
#include <cstdlib> #include <cstdlib>
#include <boost/filesystem.hpp> #include <experimental/filesystem>
enum { enum {