lokinet/vendor/cppbackport-master/lib/filesystem.h
despair86 bdc54835c2 initial windows server port. Requires Windows 2000 Server or later.
- updated CMake build script
- builds with Microsoft C++ 19.1x. such builds require Windows 8.1 or later
  unless you have the .NET Server 2003-toolset (v141_xp)
- windows port requires a C++17 compiler since cpp17::filesystem is POSIX-only
- HAVE_CXX17_FILESYSTEM manual toggle in CMake. You must manually specify where
  std::[experimental::]filesystem is defined in LDFLAGS or CMAKE_x_LINKER_FLAGS.
- IPv6 support can be added at any time, and the windows sdk still has that
  inline getaddrinfo(3) if it can't find a suitable IPv6 stack.
- inline code for mingw-w64: there's a few bits and pieces still missing simply because
  mingw-w64 derives its windows sdk from wine and reactos, and then writing all the newer
  stuff into it by hand straight from the MSDN manpages.
- misc. C++11 stuff (nullptr and friends)
- Internal file handling code takes UTF-8 or plain 8-bit text, NTFS is UTF-16, so
  std::filesystem::path::c_str() is wchar_t. That's no good unless you first
  call std::filesystem::path::string().
- implemented getifaddrs(3) and if_nametoindex(3) on top of GetAdapters[Info|Addresses](2).
- updated readme with new info

BONUS: may implement Solaris/illumos IOCP someday...

-despair86
2018-08-01 23:41:02 -05:00

70 lines
2.4 KiB
C

/* Copyright (c) 2016, Pollard Banknote Limited
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its contributors
may be used to endorse or promote products derived from this software without
specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef PBL_CPP_FILESYSTEM_H
#define PBL_CPP_FILESYSTEM_H
#if _MSC_VER >= 1910
#define CPP17
#define CPP11
#define CPP14
#endif
#include "version.h"
#if defined(CPP17) && defined(USE_CXX17_FILESYSTEM)
#if defined(__MINGW32__) || defined(_MSC_VER)
// win32 needs experimental
#include <experimental/filesystem>
#else
#include <filesystem>
#endif
#else
// OpenBSD needs this
// MacOS llvm 3.8 needs this
#include "fs/absolute.h"
#include "fs/basename.h"
#include "fs/cleanpath.h"
#include "fs/copyfile.h"
#include "fs/create_directory.h"
#include "fs/current_path.h"
#include "fs/direntry.h"
#include "fs/diriter.h"
#include "fs/equivalent.h"
#include "fs/filestatus.h"
#include "fs/filetype.h"
#include "fs/path.h"
#include "fs/perms.h"
#include "fs/remove.h"
#include "fs/rename.h"
#include "fs/tempdir.h"
#endif // if not cpp17 and not openbsd
#endif // PBL_CPP_FILESYSTEM_H