diff --git a/cpp.cpp b/cpp.cpp index 18020a4f..13a96505 100644 --- a/cpp.cpp +++ b/cpp.cpp @@ -38,7 +38,7 @@ processor::add (std::string token, std::unique_ptr handler) //----------------------------------------------------------------------------- void -processor::process (std::ostream &os, const std::experimental::filesystem::path &src) const +processor::process (std::ostream &os, const std::filesystem::path &src) const { const auto data = cruft::slurp (src); context ctx; @@ -148,7 +148,7 @@ include::process (std::ostream &os, cruft::view::iterator> lines) const { const auto name = lines.begin ()->slice (strlen("#include '"), -2); - std::experimental::filesystem::path fragment { name.begin (), name.end () }; + std::filesystem::path fragment { name.begin (), name.end () }; const auto target = ctx.source.top ().parent_path () / fragment; const auto data = cruft::slurp (target); diff --git a/cpp.hpp b/cpp.hpp index 7b044bd1..d2ab3e97 100644 --- a/cpp.hpp +++ b/cpp.hpp @@ -12,7 +12,7 @@ #include "string.hpp" #include "view.hpp" -#include +#include #include #include #include @@ -21,7 +21,7 @@ namespace cruft::cpp { /////////////////////////////////////////////////////////////////////////// struct context { - std::stack source; + std::stack source; std::map defines; }; @@ -52,10 +52,10 @@ namespace cruft::cpp { processor (); void add (std::string token, std::unique_ptr); - void process (std::ostream&, const std::experimental::filesystem::path&) const; + void process (std::ostream&, const std::filesystem::path&) const; - std::experimental::filesystem::path - resolve (const std::experimental::filesystem::path&) const; + std::filesystem::path + resolve (const std::filesystem::path&) const; cruft::tokeniser::iterator process (std::ostream&, @@ -111,7 +111,7 @@ namespace cruft::cpp { public: include (processor &_parent); - void add (const std::experimental::filesystem::path&); + void add (const std::filesystem::path&); virtual cruft::tokeniser::iterator process (std::ostream&, @@ -120,7 +120,7 @@ namespace cruft::cpp { private: processor &m_parent; - std::vector m_paths; + std::vector m_paths; }; }; diff --git a/exe.hpp b/exe.hpp index a0dfd518..9c15a4c8 100644 --- a/exe.hpp +++ b/exe.hpp @@ -9,11 +9,11 @@ #ifndef __UTIL_EXE_HPP #define __UTIL_EXE_HPP -#include +#include namespace cruft { /// Returns a path to the current executable. - std::experimental::filesystem::path image_path (void); + std::filesystem::path image_path (void); } #endif diff --git a/exe_freebsd.cpp b/exe_freebsd.cpp index b5ed555a..64f802d6 100644 --- a/exe_freebsd.cpp +++ b/exe_freebsd.cpp @@ -5,7 +5,7 @@ #include #include -std::experimental::filesystem::path +std::filesystem::path cruft::image_path (void) { int name[] = { @@ -21,5 +21,5 @@ cruft::image_path (void) auto err = sysctl (name, elems (name), data, &len, nullptr, 0); errno_error::try_code (err); - return std::experimental::filesystem::path (std::cbegin (data), std::cbegin (data) + len); + return std::filesystem::path (std::cbegin (data), std::cbegin (data) + len); } diff --git a/exe_linux.cpp b/exe_linux.cpp index 09a5b8f9..1370640a 100644 --- a/exe_linux.cpp +++ b/exe_linux.cpp @@ -12,13 +12,13 @@ #include "posix/except.hpp" #include -#include +#include #include /////////////////////////////////////////////////////////////////////////////// -std::experimental::filesystem::path +std::filesystem::path cruft::image_path (void) { static const char PROC_SELF[] = "/proc/self/exe"; @@ -38,6 +38,6 @@ retry: goto retry; } - return std::experimental::filesystem::path (resolved.data (), resolved.data () + written); + return std::filesystem::path (resolved.data (), resolved.data () + written); } diff --git a/exe_win32.cpp b/exe_win32.cpp index bb8609cb..ed817aa6 100644 --- a/exe_win32.cpp +++ b/exe_win32.cpp @@ -11,12 +11,12 @@ #include "win32/except.hpp" #include "win32/windows.hpp" -#include +#include #include /////////////////////////////////////////////////////////////////////////////// -std::experimental::filesystem::path +std::filesystem::path cruft::image_path (void) { std::vector resolved (256); @@ -31,5 +31,5 @@ retry: goto retry; } - return std::experimental::filesystem::path (resolved.data (), resolved.data () + written); + return std::filesystem::path (resolved.data (), resolved.data () + written); } diff --git a/fixup/experimental/filesystem.cpp b/fixup/experimental/filesystem.cpp index 495103a7..e7dbae93 100644 --- a/fixup/experimental/filesystem.cpp +++ b/fixup/experimental/filesystem.cpp @@ -15,7 +15,7 @@ #include #include -namespace ns = std::experimental::filesystem; +namespace ns = std::filesystem; /////////////////////////////////////////////////////////////////////////////// diff --git a/fixup/experimental/filesystem.hpp b/fixup/experimental/filesystem.hpp index 08aa0b38..d3d4d84d 100644 --- a/fixup/experimental/filesystem.hpp +++ b/fixup/experimental/filesystem.hpp @@ -12,7 +12,7 @@ #include /////////////////////////////////////////////////////////////////////////////// -namespace std::experimental::filesystem { +namespace std::filesystem { class path { public: using value_type = char; diff --git a/introspection.hpp b/introspection.hpp index fd9d2f8a..baca34b6 100644 --- a/introspection.hpp +++ b/introspection.hpp @@ -16,7 +16,7 @@ #include #include #include -#include +#include #include #include #include @@ -60,7 +60,7 @@ namespace cruft { CLANG_WORKAROUND(const char*, const_cstring, "cstring") CLANG_WORKAROUND(char*, cstring, "cstring") CLANG_WORKAROUND(std::string, string, "string") - CLANG_WORKAROUND(std::experimental::filesystem::path, path, "path"); + CLANG_WORKAROUND(std::filesystem::path, path, "path"); CLANG_WORKAROUND(std::byte, byte, "byte"); diff --git a/io.cpp b/io.cpp index 94e02ffc..3e6be2fe 100644 --- a/io.cpp +++ b/io.cpp @@ -18,7 +18,7 @@ #include #include -#include +#include #include @@ -28,7 +28,7 @@ using namespace cruft; ////////////////////////////////////////////////////////////////////////////// template std::vector -cruft::slurp (const std::experimental::filesystem::path &path) +cruft::slurp (const std::filesystem::path &path) { posix::fd out (path, O_RDONLY | O_BINARY); @@ -63,10 +63,10 @@ cruft::slurp (const std::experimental::filesystem::path &path) //----------------------------------------------------------------------------- -template std::vector cruft::slurp (const std::experimental::filesystem::path&); -template std::vector cruft::slurp (const std::experimental::filesystem::path&); -template std::vector cruft::slurp (const std::experimental::filesystem::path&); -template std::vector cruft::slurp (const std::experimental::filesystem::path&); +template std::vector cruft::slurp (const std::filesystem::path&); +template std::vector cruft::slurp (const std::filesystem::path&); +template std::vector cruft::slurp (const std::filesystem::path&); +template std::vector cruft::slurp (const std::filesystem::path&); /////////////////////////////////////////////////////////////////////////////// @@ -231,14 +231,14 @@ scoped_cwd::~scoped_cwd () /////////////////////////////////////////////////////////////////////////////// -path_error::path_error (const std::experimental::filesystem::path &_path): +path_error::path_error (const std::filesystem::path &_path): runtime_error (to_string (format::printf ("Unknown path: %!", m_path))), m_path (_path) { ; } //----------------------------------------------------------------------------- -const std::experimental::filesystem::path& +const std::filesystem::path& path_error::path (void) const noexcept { return m_path; diff --git a/io.hpp b/io.hpp index 9d837fec..f3f306dd 100644 --- a/io.hpp +++ b/io.hpp @@ -15,7 +15,7 @@ #include #include #include -#include +#include #include #include @@ -30,7 +30,7 @@ namespace cruft { /// Reads an entire file into memory in one operation. template std::vector - slurp (const std::experimental::filesystem::path&); + slurp (std::filesystem::path const&); ///------------------------------------------------------------------------ @@ -135,12 +135,12 @@ namespace cruft { //------------------------------------------------------------------------- class path_error : public std::runtime_error { public: - explicit path_error (const std::experimental::filesystem::path &path); + explicit path_error (std::filesystem::path const &path); - const std::experimental::filesystem::path& path (void) const noexcept; + std::filesystem::path const& path (void) const noexcept; private: - const std::experimental::filesystem::path m_path; + std::filesystem::path const m_path; }; class stream_error : public std::exception { diff --git a/io_posix.cpp b/io_posix.cpp index c48bec84..ccb75d68 100644 --- a/io_posix.cpp +++ b/io_posix.cpp @@ -19,7 +19,7 @@ using cruft::detail::posix::mapped_file; ////////////////////////////////////////////////////////////////////////////// -mapped_file::mapped_file (const std::experimental::filesystem::path &path, +mapped_file::mapped_file (const std::filesystem::path &path, int fflags, int mflags): mapped_file (cruft::posix::fd (path, fflags), mflags) diff --git a/io_posix.hpp b/io_posix.hpp index 5c8d4318..196d63e0 100644 --- a/io_posix.hpp +++ b/io_posix.hpp @@ -14,7 +14,7 @@ #include "view.hpp" #include -#include +#include #include #include @@ -36,7 +36,7 @@ namespace cruft { using difference_type = std::iterator_traits::difference_type; using size_type = size_t; - mapped_file (const std::experimental::filesystem::path&, + mapped_file (const std::filesystem::path&, int fflags = O_RDONLY | O_BINARY, int mflags = PROT_READ); mapped_file (const cruft::posix::fd&, diff --git a/io_win32.cpp b/io_win32.cpp index 58402d8b..704bd823 100644 --- a/io_win32.cpp +++ b/io_win32.cpp @@ -114,7 +114,7 @@ mapped_file::mapped_file (::cruft::win32::handle &&src, //----------------------------------------------------------------------------- mapped_file::mapped_file ( - std::experimental::filesystem::path const &path, + std::filesystem::path const &path, int fflags, int mflags ) diff --git a/io_win32.hpp b/io_win32.hpp index a5898c38..2e8d0572 100644 --- a/io_win32.hpp +++ b/io_win32.hpp @@ -17,7 +17,7 @@ #include "view.hpp" #include -#include +#include #include #include #include @@ -59,7 +59,7 @@ namespace cruft { mapped_file (::cruft::win32::handle &&, int fflags = O_RDONLY, int mflags = PROT_READ); - mapped_file (const std::experimental::filesystem::path &path, + mapped_file (const std::filesystem::path &path, int fflags = O_RDONLY, int mflags = PROT_READ); mapped_file (cruft::posix::fd const&, diff --git a/library_posix.cpp b/library_posix.cpp index 3aab01fb..f6809af9 100644 --- a/library_posix.cpp +++ b/library_posix.cpp @@ -15,7 +15,7 @@ using cruft::detail::library_posix; /////////////////////////////////////////////////////////////////////////////// -library_posix::library_posix (const std::experimental::filesystem::path &path): +library_posix::library_posix (const std::filesystem::path &path): m_handle (dlopen (path.c_str (), RTLD_NOW)) { if (!m_handle) diff --git a/library_posix.hpp b/library_posix.hpp index 5ba435ee..c75a540e 100644 --- a/library_posix.hpp +++ b/library_posix.hpp @@ -9,7 +9,7 @@ #ifndef __UTIL_LIBRARY_POSIX_HPP #define __UTIL_LIBRARY_POSIX_HPP -#include +#include #include @@ -17,7 +17,7 @@ namespace cruft { namespace detail { class library_posix { public: - explicit library_posix (const std::experimental::filesystem::path&); + explicit library_posix (const std::filesystem::path&); library_posix (library_posix&&) noexcept; ~library_posix (); diff --git a/library_win32.cpp b/library_win32.cpp index 00d48121..e48bb0d3 100644 --- a/library_win32.cpp +++ b/library_win32.cpp @@ -14,7 +14,7 @@ using cruft::detail::win32::library; /////////////////////////////////////////////////////////////////////////////// -library::library (const std::experimental::filesystem::path &path): +library::library (const std::filesystem::path &path): m_handle (LoadLibraryA (path.u8string ().c_str ())) { if (!m_handle) diff --git a/library_win32.hpp b/library_win32.hpp index 6f0d4367..00c33408 100644 --- a/library_win32.hpp +++ b/library_win32.hpp @@ -13,13 +13,13 @@ #include -#include +#include namespace cruft { namespace detail::win32 { class library { public: - explicit library (const std::experimental::filesystem::path&); + explicit library (const std::filesystem::path&); library (library const&) = delete; library& operator=(library const&) = delete; library (library&&); diff --git a/posix/dir.cpp b/posix/dir.cpp index 60a51db5..3f952271 100644 --- a/posix/dir.cpp +++ b/posix/dir.cpp @@ -14,7 +14,7 @@ using cruft::posix::dir; /////////////////////////////////////////////////////////////////////////////// -dir::dir (const std::experimental::filesystem::path &p): +dir::dir (const std::filesystem::path &p): m_handle (::opendir (p.u8string ().c_str ())) { if (!m_handle) diff --git a/posix/dir.hpp b/posix/dir.hpp index ad6131ed..02f05695 100644 --- a/posix/dir.hpp +++ b/posix/dir.hpp @@ -15,13 +15,13 @@ #include #include -#include +#include namespace cruft::posix { struct dir { public: - explicit dir (const std::experimental::filesystem::path&); + explicit dir (const std::filesystem::path&); ~dir (); operator DIR* (void); diff --git a/posix/fd.cpp b/posix/fd.cpp index 64a226b4..0b852818 100644 --- a/posix/fd.cpp +++ b/posix/fd.cpp @@ -19,13 +19,13 @@ using cruft::posix::fd; /////////////////////////////////////////////////////////////////////////////// -fd::fd (const std::experimental::filesystem::path &path, int flags): +fd::fd (const std::filesystem::path &path, int flags): fd (path, flags, 0666) { ; } //----------------------------------------------------------------------------- -fd::fd (const std::experimental::filesystem::path &path, int flags, mode_t mode): +fd::fd (const std::filesystem::path &path, int flags, mode_t mode): m_fd (error::try_value (::open (path.u8string ().c_str (), flags, mode))) { // You always want binary mode. Always. diff --git a/posix/fd.hpp b/posix/fd.hpp index 0ac0e5dc..73e4c7cf 100644 --- a/posix/fd.hpp +++ b/posix/fd.hpp @@ -12,7 +12,7 @@ #include "../debug.hpp" #include "../view.hpp" -#include +#include #include #include @@ -33,8 +33,8 @@ namespace cruft::posix { // If you are using a system which delineates between binary/text mode // for descriptors the behaviour is undefined if you don't set the // necessary flags for binary mode. - fd (const std::experimental::filesystem::path &path, int flags); - fd (const std::experimental::filesystem::path &path, int flags, mode_t); + fd (const std::filesystem::path &path, int flags); + fd (const std::filesystem::path &path, int flags, mode_t); fd (fd &&) noexcept; fd& operator= (fd &&) noexcept; diff --git a/term.cpp b/term.cpp index e9b8a74c..f9831a39 100644 --- a/term.cpp +++ b/term.cpp @@ -10,7 +10,7 @@ #include "string.hpp" -#include +#include #include #include @@ -24,14 +24,14 @@ const graphics graphics::RESET (0); // // throws an exception if not found static -std::experimental::filesystem::path -find_terminfo_path (const std::experimental::filesystem::path &dir, +std::filesystem::path +find_terminfo_path (const std::filesystem::path &dir, const std::string &key) { const char letter[2] = { key[0], '\0' }; auto candidate = dir / letter / key; - if (!std::experimental::filesystem::is_directory (candidate)) + if (!std::filesystem::is_directory (candidate)) throw std::runtime_error ("path not found"); return candidate; @@ -43,10 +43,10 @@ find_terminfo_path (const std::experimental::filesystem::path &dir, // // throws an exception if not found static -std::experimental::filesystem::path +std::filesystem::path find_terminfo_path [[gnu::unused]] (const std::string &key) { - static const std::experimental::filesystem::path DEFAULT_SEARCH_DIR = "/usr/share/terminfo"; + static const std::filesystem::path DEFAULT_SEARCH_DIR = "/usr/share/terminfo"; // check if the path is explicitly listed. must not fall through. if (const char *dir = getenv ("TERMINFO")) { @@ -55,7 +55,7 @@ find_terminfo_path [[gnu::unused]] (const std::string &key) // check if we have a path at $HOME. falls through. if (const char *home = getenv ("HOME")) { - std::experimental::filesystem::path HOME (home); + std::filesystem::path HOME (home); try { return find_terminfo_path (HOME / ".terminfo", key); } catch (...) { } @@ -70,7 +70,7 @@ find_terminfo_path [[gnu::unused]] (const std::string &key) return find_terminfo_path ( i.empty () ? DEFAULT_SEARCH_DIR : - std::experimental::filesystem::path (i.cbegin (), i.cend ()), key + std::filesystem::path (i.cbegin (), i.cend ()), key ); } catch (...) { } } diff --git a/test/exe.cpp b/test/exe.cpp index 43be913c..84cee43c 100644 --- a/test/exe.cpp +++ b/test/exe.cpp @@ -2,7 +2,7 @@ #include "../exe.hpp" -#include +#include /////////////////////////////////////////////////////////////////////////////// @@ -18,7 +18,7 @@ main (int, char **argv) // so we compare the filename instead under the assumption that it should // be stable across path styles. auto const query = cruft::image_path (); - auto const truth = std::experimental::filesystem::path (argv[0]); + auto const truth = std::filesystem::path (argv[0]); tap.expect_eq ( query.stem (), truth.stem (), diff --git a/tools/json-schema.cpp b/tools/json-schema.cpp index 556f6a21..3adb10ae 100644 --- a/tools/json-schema.cpp +++ b/tools/json-schema.cpp @@ -15,11 +15,11 @@ #include "io.hpp" -#include +#include #include -namespace fs = std::experimental::filesystem; +namespace fs = std::filesystem; /////////////////////////////////////////////////////////////////////////////// diff --git a/tools/macro.cpp b/tools/macro.cpp index 50e68c60..cdaad298 100644 --- a/tools/macro.cpp +++ b/tools/macro.cpp @@ -20,7 +20,7 @@ enum { #if 0 /////////////////////////////////////////////////////////////////////////////// -void process (std::ostream &dst, const std::experimental::filesystem::path&); +void process (std::ostream &dst, const std::filesystem::path&); /////////////////////////////////////////////////////////////////////////////// @@ -42,7 +42,7 @@ struct include { /////////////////////////////////////////////////////////////////////////////// void -process (std::ostream &dst, const std::experimental::filesystem::path &src) +process (std::ostream &dst, const std::filesystem::path &src) { auto data = cruft::slurp (src); include handler; @@ -68,7 +68,7 @@ main (const int argc, const char **argv) return EXIT_FAILURE; } - std::experimental::filesystem::path src = argv[ARG_SRC]; + std::filesystem::path src = argv[ARG_SRC]; if (argc == 3) { std::ofstream dst (argv[ARG_DST]);