diff options
Diffstat (limited to '3rdParty/Boost/src/libs/filesystem')
| -rw-r--r-- | 3rdParty/Boost/src/libs/filesystem/src/codecvt_error_category.cpp (renamed from 3rdParty/Boost/src/libs/filesystem/v3/src/codecvt_error_category.cpp) | 17 | ||||
| -rw-r--r-- | 3rdParty/Boost/src/libs/filesystem/src/filesystem_utf8_codecvt_facet.cpp (renamed from 3rdParty/Boost/src/libs/filesystem/v3/src/filesystem_utf8_codecvt_facet.cpp) | 6 | ||||
| -rw-r--r-- | 3rdParty/Boost/src/libs/filesystem/src/operations.cpp (renamed from 3rdParty/Boost/src/libs/filesystem/v3/src/operations.cpp) | 479 | ||||
| -rw-r--r-- | 3rdParty/Boost/src/libs/filesystem/src/path.cpp (renamed from 3rdParty/Boost/src/libs/filesystem/v3/src/path.cpp) | 356 | ||||
| -rw-r--r-- | 3rdParty/Boost/src/libs/filesystem/src/path_traits.cpp (renamed from 3rdParty/Boost/src/libs/filesystem/v3/src/path_traits.cpp) | 21 | ||||
| -rw-r--r-- | 3rdParty/Boost/src/libs/filesystem/src/portability.cpp (renamed from 3rdParty/Boost/src/libs/filesystem/v3/src/portability.cpp) | 19 | ||||
| -rw-r--r-- | 3rdParty/Boost/src/libs/filesystem/src/unique_path.cpp (renamed from 3rdParty/Boost/src/libs/filesystem/v3/src/unique_path.cpp) | 15 | ||||
| -rw-r--r-- | 3rdParty/Boost/src/libs/filesystem/src/windows_file_codecvt.cpp (renamed from 3rdParty/Boost/src/libs/filesystem/v3/src/windows_file_codecvt.cpp) | 14 | ||||
| -rw-r--r-- | 3rdParty/Boost/src/libs/filesystem/src/windows_file_codecvt.hpp (renamed from 3rdParty/Boost/src/libs/filesystem/v3/src/windows_file_codecvt.hpp) | 2 | ||||
| -rw-r--r-- | 3rdParty/Boost/src/libs/filesystem/v2/src/v2_operations.cpp | 1372 | ||||
| -rw-r--r-- | 3rdParty/Boost/src/libs/filesystem/v2/src/v2_path.cpp | 177 | ||||
| -rw-r--r-- | 3rdParty/Boost/src/libs/filesystem/v2/src/v2_portability.cpp | 119 | 
12 files changed, 639 insertions, 1958 deletions
diff --git a/3rdParty/Boost/src/libs/filesystem/v3/src/codecvt_error_category.cpp b/3rdParty/Boost/src/libs/filesystem/src/codecvt_error_category.cpp index b35b4a9..245c3f3 100644 --- a/3rdParty/Boost/src/libs/filesystem/v3/src/codecvt_error_category.cpp +++ b/3rdParty/Boost/src/libs/filesystem/src/codecvt_error_category.cpp @@ -9,13 +9,6 @@  //--------------------------------------------------------------------------------------// -#include <boost/config.hpp> -#if !defined( BOOST_NO_STD_WSTRING ) -// Boost.Filesystem V3 and later requires std::wstring support. -// During the transition to V3, libraries are compiled with both V2 and V3 sources. -// On old compilers that don't support V3 anyhow, we just skip everything so the compile -// will succeed and the library can be built. -  #include <boost/config/warning_disable.hpp>  // define BOOST_FILESYSTEM_SOURCE so that <boost/filesystem/config.hpp> knows @@ -26,8 +19,8 @@  #  define BOOST_SYSTEM_NO_DEPRECATED  #endif -#include <boost/filesystem/v3/config.hpp> -#include <boost/filesystem/v3/path_traits.hpp> +#include <boost/filesystem/config.hpp> +#include <boost/filesystem/path_traits.hpp>  #include <boost/system/error_code.hpp>  #include <locale>  #include <vector> @@ -78,7 +71,7 @@ namespace  namespace boost  { -  namespace filesystem3 +  namespace filesystem    {      BOOST_FILESYSTEM_DECL const boost::system::error_category& codecvt_error_category() @@ -87,7 +80,5 @@ namespace boost        return codecvt_error_cat_const;      } -  } // namespace filesystem3 +  } // namespace filesystem  } // namespace boost - -#endif  // no wide character support diff --git a/3rdParty/Boost/src/libs/filesystem/v3/src/filesystem_utf8_codecvt_facet.cpp b/3rdParty/Boost/src/libs/filesystem/src/filesystem_utf8_codecvt_facet.cpp index 1849a1a..8a5af1e 100644 --- a/3rdParty/Boost/src/libs/filesystem/v3/src/filesystem_utf8_codecvt_facet.cpp +++ b/3rdParty/Boost/src/libs/filesystem/src/filesystem_utf8_codecvt_facet.cpp @@ -3,6 +3,10 @@  // (See accompanying file LICENSE_1_0.txt  // or copy at http://www.boost.org/LICENSE_1_0.txt) +// For HP-UX, request that WCHAR_MAX and WCHAR_MIN be defined as macros, +// not casts. See ticket 5048 +#define _INCLUDE_STDCSOURCE_199901 +  #ifndef BOOST_SYSTEM_NO_DEPRECATED   # define BOOST_SYSTEM_NO_DEPRECATED  #endif @@ -16,7 +20,7 @@  #define BOOST_UTF8_END_NAMESPACE }}}  #define BOOST_UTF8_DECL BOOST_FILESYSTEM_DECL -#include "libs/detail/utf8_codecvt_facet.cpp" +#include <boost/detail/utf8_codecvt_facet.ipp>  #undef BOOST_UTF8_BEGIN_NAMESPACE  #undef BOOST_UTF8_END_NAMESPACE diff --git a/3rdParty/Boost/src/libs/filesystem/v3/src/operations.cpp b/3rdParty/Boost/src/libs/filesystem/src/operations.cpp index 2460c1d..16a336f 100644 --- a/3rdParty/Boost/src/libs/filesystem/v3/src/operations.cpp +++ b/3rdParty/Boost/src/libs/filesystem/src/operations.cpp @@ -10,28 +10,8 @@  //--------------------------------------------------------------------------------------//  -#include <boost/config.hpp> -#if !defined( BOOST_NO_STD_WSTRING ) -// Boost.Filesystem V3 and later requires std::wstring support. -// During the transition to V3, libraries are compiled with both V2 and V3 sources. -// On old compilers that don't support V3 anyhow, we just skip everything so the compile -// will succeed and the library can be built. - -// define BOOST_FILESYSTEM_SOURCE so that <boost/filesystem/config.hpp> knows -// the library is being built (possibly exporting rather than importing code) - -#define BOOST_FILESYSTEM_SOURCE  - -#ifndef BOOST_SYSTEM_NO_DEPRECATED  -# define BOOST_SYSTEM_NO_DEPRECATED -#endif - -#ifndef _POSIX_PTHREAD_SEMANTICS -# define _POSIX_PTHREAD_SEMANTICS  // Sun readdir_r()needs this -#endif - -#if !(defined(__HP_aCC) && defined(_ILP32) && \ -      !defined(_STATVFS_ACPP_PROBLEMS_FIXED)) +//  define 64-bit offset macros BEFORE including boost/config.hpp (see ticket #5355)  +#if !(defined(__HP_aCC) && defined(_ILP32) && !defined(_STATVFS_ACPP_PROBLEMS_FIXED))  #define _FILE_OFFSET_BITS 64 // at worst, these defines may have no effect,  #endif  #if !defined(__PGI) @@ -49,19 +29,38 @@  #define _FILE_OFFSET_BITS 64  #endif -#include <boost/filesystem/v3/operations.hpp> +// define BOOST_FILESYSTEM_SOURCE so that <boost/filesystem/config.hpp> knows +// the library is being built (possibly exporting rather than importing code) +#define BOOST_FILESYSTEM_SOURCE  + +#ifndef BOOST_SYSTEM_NO_DEPRECATED  +# define BOOST_SYSTEM_NO_DEPRECATED +#endif + +#ifndef _POSIX_PTHREAD_SEMANTICS +# define _POSIX_PTHREAD_SEMANTICS  // Sun readdir_r()needs this +#endif + +#include <boost/filesystem/operations.hpp>  #include <boost/scoped_array.hpp>  #include <boost/detail/workaround.hpp> -#include <cstdlib>  // for malloc, free -#include <vector> +#include <vector>  +#include <cstdlib>     // for malloc, free +#include <cstring> +#include <cstdio>      // for remove, rename +#if defined(__QNXNTO__)  // see ticket #5355  +# include <stdio.h> +#endif +#include <cerrno>  #ifdef BOOST_FILEYSTEM_INCLUDE_IOSTREAM  # include <iostream>  #endif -namespace fs = boost::filesystem3; -using boost::filesystem3::path; -using boost::filesystem3::filesystem_error; +namespace fs = boost::filesystem; +using boost::filesystem::path; +using boost::filesystem::filesystem_error; +using boost::filesystem::perms;  using boost::system::error_code;  using boost::system::error_category;  using boost::system::system_category; @@ -70,7 +69,10 @@ using std::wstring;  # ifdef BOOST_POSIX_API +    const fs::path dot_path("."); +    const fs::path dot_dot_path("..");  #   include <sys/types.h> +#   include <sys/stat.h>  #   if !defined(__APPLE__) && !defined(__OpenBSD__)  #     include <sys/statvfs.h>  #     define BOOST_STATVFS statvfs @@ -91,11 +93,14 @@ using std::wstring;  # else // BOOST_WINDOW_API +    const fs::path dot_path(L"."); +    const fs::path dot_dot_path(L"..");  #   if (defined(__MINGW32__) || defined(__CYGWIN__)) && !defined(WINVER)        // Versions of MinGW or Cygwin that support Filesystem V3 support at least WINVER 0x501.        // See MinGW's windef.h  #     define WINVER 0x501  #   endif +#   include <io.h>  #   include <windows.h>  #   include <winnt.h>  #   if !defined(_WIN32_WINNT) @@ -178,14 +183,6 @@ typedef struct _REPARSE_DATA_BUFFER {  #   define BOOST_FILESYSTEM_STATUS_CACHE  # endif -#include <sys/stat.h>  // even on Windows some functions use stat() -#include <string> -#include <cstring> -#include <cstdio>      // for remove, rename -#include <cerrno> -#include <cassert> -// #include <iostream>    // for debugging only; comment out when not in use -  //  POSIX/Windows macros  ----------------------------------------------------//  //  Portions of the POSIX and Windows API's are very similar, except for name, @@ -226,7 +223,7 @@ typedef struct _REPARSE_DATA_BUFFER {  #   define BOOST_DELETE_FILE(P)(::DeleteFileW(P)!= 0)  #   define BOOST_COPY_DIRECTORY(F,T)(::CreateDirectoryExW(F, T, 0)!= 0)  #   define BOOST_COPY_FILE(F,T,FailIfExistsBool)(::CopyFileW(F, T, FailIfExistsBool)!= 0) -#   define BOOST_MOVE_FILE(OLD,NEW)(::MoveFileExW(OLD, NEW, MOVEFILE_REPLACE_EXISTING)!= 0) +#   define BOOST_MOVE_FILE(OLD,NEW)(::MoveFileExW(OLD, NEW, MOVEFILE_REPLACE_EXISTING|MOVEFILE_COPY_ALLOWED)!= 0)  #   define BOOST_RESIZE_FILE(P,SZ)(resize_file_api(P, SZ)!= 0)  #   define BOOST_READ_SYMLINK(P,T) @@ -244,15 +241,9 @@ typedef struct _REPARSE_DATA_BUFFER {  namespace  { -# ifdef BOOST_POSIX_API -  const char dot = '.'; -# else -  const wchar_t dot = L'.'; -# endif -    fs::file_type query_file_type(const path& p, error_code* ec); -  boost::filesystem3::directory_iterator end_dir_itr; +  boost::filesystem::directory_iterator end_dir_itr;    const std::size_t buf_size(128);    const error_code ok; @@ -411,6 +402,8 @@ namespace  //                                                                                      //  //--------------------------------------------------------------------------------------// +  const char dot = '.'; +    bool not_found_error(int errval)    {      return errno == ENOENT || errno == ENOTDIR; @@ -432,7 +425,10 @@ namespace      struct stat from_stat;      if (::stat(from_p.c_str(), &from_stat)!= 0) -      { return false; } +    {  +      ::close(infile); +      return false; +    }      int oflag = O_CREAT | O_WRONLY | O_TRUNC;      if (fail_if_exists) @@ -484,6 +480,8 @@ namespace  //                                                                                      //  //--------------------------------------------------------------------------------------// +  const wchar_t dot = L'.'; +    bool not_found_error(int errval)    {      return errval == ERROR_FILE_NOT_FOUND @@ -496,6 +494,28 @@ namespace        || errval == ERROR_BAD_NETPATH;  // "//nosuch" on Win32    } +// some distributions of mingw as early as GLIBCXX__ 20110325 have _stricmp, but the +// offical 4.6.2 release with __GLIBCXX__ 20111026  doesn't. Play it safe for now, and +// only use _stricmp if _MSC_VER is defined +#if defined(_MSC_VER) // || (defined(__GLIBCXX__) && __GLIBCXX__ >= 20110325) +#  define BOOST_FILESYSTEM_STRICMP _stricmp +#else +#  define BOOST_FILESYSTEM_STRICMP strcmp +#endif + +  perms make_permissions(const path& p, DWORD attr) +  { +    perms prms = fs::owner_read | fs::group_read | fs::others_read; +    if  ((attr & FILE_ATTRIBUTE_READONLY) == 0) +      prms |= fs::owner_write | fs::group_write | fs::others_write; +    if (BOOST_FILESYSTEM_STRICMP(p.extension().string().c_str(), ".exe") == 0 +      || BOOST_FILESYSTEM_STRICMP(p.extension().string().c_str(), ".com") == 0 +      || BOOST_FILESYSTEM_STRICMP(p.extension().string().c_str(), ".bat") == 0 +      || BOOST_FILESYSTEM_STRICMP(p.extension().string().c_str(), ".cmd") == 0) +      prms |= fs::owner_exe | fs::group_exe | fs::others_exe; +    return prms; +  } +    // these constants come from inspecting some Microsoft sample code    std::time_t to_time_t(const FILETIME & ft)    { @@ -584,7 +604,7 @@ namespace      if (not_found_error(errval))      { -      return fs::file_status(fs::file_not_found); +      return fs::file_status(fs::file_not_found, fs::no_perms);      }      else if ((errval == ERROR_SHARING_VIOLATION))      { @@ -679,7 +699,7 @@ namespace  namespace boost  { -namespace filesystem3 +namespace filesystem  {    BOOST_FILESYSTEM_DECL @@ -750,6 +770,86 @@ namespace detail    }    BOOST_FILESYSTEM_DECL +  path canonical(const path& p, const path& base, system::error_code* ec) +  { +    path source (p.is_absolute() ? p : absolute(p, base)); +    path result; + +    system::error_code local_ec; +    file_status stat (status(source, local_ec)); + +    if (stat.type() == fs::file_not_found) +    { +      if (ec == 0) +        BOOST_FILESYSTEM_THROW(filesystem_error( +          "boost::filesystem::canonical", source, +          error_code(system::errc::no_such_file_or_directory, system::generic_category()))); +      ec->assign(system::errc::no_such_file_or_directory, system::generic_category()); +      return result; +    } +    else if (local_ec) +    { +      if (ec == 0) +        BOOST_FILESYSTEM_THROW(filesystem_error( +          "boost::filesystem::canonical", source, local_ec)); +      *ec = local_ec; +      return result; +    } + +    bool scan (true); +    while (scan) +    { +      scan = false; +      result.clear(); +      for (path::iterator itr = source.begin(); itr != source.end(); ++itr) +      { +        if (*itr == dot_path) +          continue; +        if (*itr == dot_dot_path) +        { +          result.remove_filename(); +          continue; +        } + +        result /= *itr; + +        bool is_sym (is_symlink(detail::symlink_status(result, ec))); +        if (ec && *ec) +          return path(); + +        if (is_sym) +        { +          path link(detail::read_symlink(result, ec)); +          if (ec && *ec) +            return path(); +          result.remove_filename(); + +          if (link.is_absolute()) +          { +            for (++itr; itr != source.end(); ++itr) +              link /= *itr; +            source = link; +          } +          else // link is relative +          { +            path new_source(result); +            new_source /= link; +            for (++itr; itr != source.end(); ++itr) +              new_source /= *itr; +            source = new_source; +          } +          scan = true;  // symlink causes scan to be restarted +          break; +        } +      } +    } +    if (ec != 0) +      ec->clear(); +    BOOST_ASSERT_MSG(result.is_absolute(), "canonical() implementation error; please report"); +    return result; +  } + +  BOOST_FILESYSTEM_DECL    void copy(const path& from, const path& to, system::error_code* ec)    {      file_status s(symlink_status(from, *ec)); @@ -813,27 +913,43 @@ namespace detail  # endif    } -  BOOST_FILESYSTEM_DECL + BOOST_FILESYSTEM_DECL    bool create_directories(const path& p, system::error_code* ec)    { -    if (p.empty() || exists(p)) +    error_code local_ec; +    file_status p_status = status(p, local_ec); + +    if (p_status.type() == directory_file)      { -      if (!p.empty() && !is_directory(p)) +      if (ec != 0) +        ec->clear(); +      return false; +    } + +    path parent = p.parent_path(); +    if (!parent.empty()) +    { +      // determine if the parent exists +      file_status parent_status = status(parent, local_ec); + +      // if the parent does not exist, create the parent +      if (parent_status.type() == file_not_found)        { -        if (ec == 0) -        BOOST_FILESYSTEM_THROW(filesystem_error( -            "boost::filesystem::create_directories", p, -            error_code(system::errc::file_exists, system::generic_category()))); -        else ec->assign(system::errc::file_exists, system::generic_category()); +        create_directories(parent, local_ec); +        if (local_ec) +        { +          if (ec == 0) +            BOOST_FILESYSTEM_THROW(filesystem_error( +              "boost::filesystem::create_directories", parent, local_ec)); +          else +            *ec = local_ec; +          return false; +        }        } -      return false;      } -    // First create branch, by calling ourself recursively -    create_directories(p.parent_path(), ec); -    // Now that parent's path exists, create the directory -    create_directory(p, ec); -    return true; +    // create the directory +    return create_directory(p, ec);    }    BOOST_FILESYSTEM_DECL @@ -841,7 +957,8 @@ namespace detail    {      if (BOOST_CREATE_DIRECTORY(p.c_str()))      { -      if (ec != 0) ec->clear(); +      if (ec != 0) +        ec->clear();        return true;      } @@ -850,7 +967,8 @@ namespace detail      error_code dummy;      if (errval == BOOST_ERROR_ALREADY_EXISTS && is_directory(p, dummy))      { -      if (ec != 0) ec->clear(); +      if (ec != 0) +        ec->clear();        return false;      } @@ -1243,6 +1361,94 @@ namespace detail  #   endif    } +# ifdef BOOST_POSIX_API +    const perms active_bits(all_all | set_uid_on_exe | set_gid_on_exe | sticky_bit); +    inline mode_t mode_cast(perms prms) { return prms & active_bits; } +# endif + +  BOOST_FILESYSTEM_DECL +  void permissions(const path& p, perms prms, system::error_code* ec) +  { +    BOOST_ASSERT_MSG(!((prms & add_perms) && (prms & remove_perms)), +      "add_perms and remove_perms are mutually exclusive"); + +    if ((prms & add_perms) && (prms & remove_perms))  // precondition failed +      return; + +# ifdef BOOST_POSIX_API +    error_code local_ec; +    file_status current_status((prms & symlink_perms) +                               ? fs::symlink_status(p, local_ec) +                               : fs::status(p, local_ec)); +    if (local_ec) +    { +      if (ec == 0) +      BOOST_FILESYSTEM_THROW(filesystem_error( +          "boost::filesystem::permissions", p, local_ec)); +      else +        *ec = local_ec; +      return; +    } + +    if (prms & add_perms) +      prms |= current_status.permissions(); +    else if (prms & remove_perms) +      prms = current_status.permissions() & ~prms; + +    // Mac OS X Lion and some other platforms don't support fchmodat(). +    // Solaris (SunPro and gcc) only support fchmodat() on Solaris 11 and higher, +    // and a runtime check is too much trouble. +    // Linux does not support permissions on symbolic links and has no plans to +    // support them in the future.  The chmod() code is thus more practical, +    // rather than always hitting ENOTSUP when sending in AT_SYMLINK_NO_FOLLOW. +    //  - See the 3rd paragraph of +    // "Symbolic link ownership, permissions, and timestamps" at: +    //   "http://man7.org/linux/man-pages/man7/symlink.7.html" +    //  - See the fchmodat() Linux man page: +    //   "http://man7.org/linux/man-pages/man2/fchmodat.2.html" +#   if defined(AT_FDCWD) && defined(AT_SYMLINK_NOFOLLOW) \ +      && !(defined(__SUNPRO_CC) || defined(sun)) \ +      && !(defined(linux) || defined(__linux) || defined(__linux__)) +      if (::fchmodat(AT_FDCWD, p.c_str(), mode_cast(prms), +           !(prms & symlink_perms) ? 0 : AT_SYMLINK_NOFOLLOW)) +#   else  // fallback if fchmodat() not supported +      if (::chmod(p.c_str(), mode_cast(prms))) +#   endif +    { +      if (ec == 0) +      BOOST_FILESYSTEM_THROW(filesystem_error( +          "boost::filesystem::permissions", p, +          error_code(errno, system::generic_category()))); +      else +        ec->assign(errno, system::generic_category()); +    } + +# else  // Windows + +    // if not going to alter FILE_ATTRIBUTE_READONLY, just return +    if (!(!((prms & (add_perms | remove_perms))) +      || (prms & (owner_write|group_write|others_write)))) +      return; + +    DWORD attr = ::GetFileAttributesW(p.c_str()); + +    if (error(attr == 0, p, ec, "boost::filesystem::permissions")) +      return; + +    if (prms & add_perms) +      attr &= ~FILE_ATTRIBUTE_READONLY; +    else if (prms & remove_perms) +      attr |= FILE_ATTRIBUTE_READONLY; +    else if (prms & (owner_write|group_write|others_write)) +      attr &= ~FILE_ATTRIBUTE_READONLY; +    else +      attr |= FILE_ATTRIBUTE_READONLY; + +    error(::SetFileAttributesW(p.c_str(), attr) == 0, +      p, ec, "boost::filesystem::permissions"); +# endif +  } +    BOOST_FILESYSTEM_DECL    path read_symlink(const path& p, system::error_code* ec)    { @@ -1406,7 +1612,7 @@ namespace detail        if (not_found_error(errno))        { -        return fs::file_status(fs::file_not_found); +        return fs::file_status(fs::file_not_found, fs::no_perms);        }        if (ec == 0)          BOOST_FILESYSTEM_THROW(filesystem_error("boost::filesystem::status", @@ -1415,17 +1621,23 @@ namespace detail      }      if (ec != 0) ec->clear();;      if (S_ISDIR(path_stat.st_mode)) -      return fs::file_status(fs::directory_file); +      return fs::file_status(fs::directory_file, +        static_cast<perms>(path_stat.st_mode) & fs::perms_mask);      if (S_ISREG(path_stat.st_mode)) -      return fs::file_status(fs::regular_file); +      return fs::file_status(fs::regular_file, +        static_cast<perms>(path_stat.st_mode) & fs::perms_mask);      if (S_ISBLK(path_stat.st_mode)) -      return fs::file_status(fs::block_file); +      return fs::file_status(fs::block_file, +        static_cast<perms>(path_stat.st_mode) & fs::perms_mask);      if (S_ISCHR(path_stat.st_mode)) -      return fs::file_status(fs::character_file); +      return fs::file_status(fs::character_file, +        static_cast<perms>(path_stat.st_mode) & fs::perms_mask);      if (S_ISFIFO(path_stat.st_mode)) -      return fs::file_status(fs::fifo_file); +      return fs::file_status(fs::fifo_file, +        static_cast<perms>(path_stat.st_mode) & fs::perms_mask);      if (S_ISSOCK(path_stat.st_mode)) -      return fs::file_status(fs::socket_file); +      return fs::file_status(fs::socket_file, +        static_cast<perms>(path_stat.st_mode) & fs::perms_mask);      return fs::file_status(fs::type_unknown);  #   else  // Windows @@ -1436,7 +1648,9 @@ namespace detail        return process_status_failure(p, ec);      } -    //  reparse point handling +    //  reparse point handling; +    //    since GetFileAttributesW does not resolve symlinks, try to open a file +    //    handle to discover if the file exists      if (attr & FILE_ATTRIBUTE_REPARSE_POINT)      {        handle_wrapper h( @@ -1454,13 +1668,13 @@ namespace detail        }        if (!is_reparse_point_a_symlink(p)) -        return file_status(reparse_file); +        return file_status(reparse_file, make_permissions(p, attr));      }      if (ec != 0) ec->clear();      return (attr & FILE_ATTRIBUTE_DIRECTORY) -      ? file_status(directory_file) -      : file_status(regular_file); +      ? file_status(directory_file, make_permissions(p, attr)) +      : file_status(regular_file, make_permissions(p, attr));  #   endif    } @@ -1478,7 +1692,7 @@ namespace detail        if (errno == ENOENT || errno == ENOTDIR) // these are not errors        { -        return fs::file_status(fs::file_not_found); +        return fs::file_status(fs::file_not_found, fs::no_perms);        }        if (ec == 0)          BOOST_FILESYSTEM_THROW(filesystem_error("boost::filesystem::status", @@ -1487,19 +1701,26 @@ namespace detail      }      if (ec != 0) ec->clear();      if (S_ISREG(path_stat.st_mode)) -      return fs::file_status(fs::regular_file); +      return fs::file_status(fs::regular_file, +        static_cast<perms>(path_stat.st_mode) & fs::perms_mask);      if (S_ISDIR(path_stat.st_mode)) -      return fs::file_status(fs::directory_file); +      return fs::file_status(fs::directory_file, +        static_cast<perms>(path_stat.st_mode) & fs::perms_mask);      if (S_ISLNK(path_stat.st_mode)) -      return fs::file_status(fs::symlink_file); +      return fs::file_status(fs::symlink_file, +        static_cast<perms>(path_stat.st_mode) & fs::perms_mask);      if (S_ISBLK(path_stat.st_mode)) -      return fs::file_status(fs::block_file); +      return fs::file_status(fs::block_file, +        static_cast<perms>(path_stat.st_mode) & fs::perms_mask);      if (S_ISCHR(path_stat.st_mode)) -      return fs::file_status(fs::character_file); +      return fs::file_status(fs::character_file, +        static_cast<perms>(path_stat.st_mode) & fs::perms_mask);      if (S_ISFIFO(path_stat.st_mode)) -      return fs::file_status(fs::fifo_file); +      return fs::file_status(fs::fifo_file, +        static_cast<perms>(path_stat.st_mode) & fs::perms_mask);      if (S_ISSOCK(path_stat.st_mode)) -      return fs::file_status(fs::socket_file); +      return fs::file_status(fs::socket_file, +        static_cast<perms>(path_stat.st_mode) & fs::perms_mask);      return fs::file_status(fs::type_unknown);  #   else  // Windows @@ -1514,12 +1735,12 @@ namespace detail      if (attr & FILE_ATTRIBUTE_REPARSE_POINT)        return is_reparse_point_a_symlink(p) -             ? file_status(symlink_file) -             : file_status(reparse_file); +             ? file_status(symlink_file, make_permissions(p, attr)) +             : file_status(reparse_file, make_permissions(p, attr));      return (attr & FILE_ATTRIBUTE_DIRECTORY) -      ? file_status(directory_file) -      : file_status(regular_file); +      ? file_status(directory_file, make_permissions(p, attr)) +      : file_status(regular_file, make_permissions(p, attr));  #   endif    } @@ -1660,7 +1881,7 @@ namespace path_traits    }  }  // namespace path_traits -} // namespace filesystem3 +} // namespace filesystem  } // namespace boost  //--------------------------------------------------------------------------------------// @@ -1752,8 +1973,8 @@ namespace      dirent * entry(static_cast<dirent *>(buffer));      dirent * result;      int return_code; -    if ((return_code = readdir_r_simulator(static_cast<DIR*>(handle), -      entry, &result))!= 0)return error_code(errno, system_category()); +    if ((return_code = readdir_r_simulator(static_cast<DIR*>(handle), entry, &result))!= 0) +      return error_code(errno, system_category());      if (result == 0)        return fs::detail::dir_itr_close(handle, buffer);      target = entry->d_name; @@ -1800,7 +2021,7 @@ namespace      if ((handle = ::FindFirstFileW(dirpath.c_str(), &data))        == INVALID_HANDLE_VALUE)      {  -      handle = 0; +      handle = 0;  // signal eof        return error_code( (::GetLastError() == ERROR_FILE_NOT_FOUND                         // Windows Mobile returns ERROR_NO_MORE_FILES; see ticket #3551                                                                    || ::GetLastError() == ERROR_NO_MORE_FILES)  @@ -1808,12 +2029,28 @@ namespace      }      target = data.cFileName;      if (data.dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT) -      // reparse points are complex, so don't try to handle them here -      { sf.type(fs::status_error); symlink_sf.type(fs::status_error); } -    else if (data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) -      { sf.type(fs::directory_file); symlink_sf.type(fs::directory_file); } +    // reparse points are complex, so don't try to handle them here; instead just mark +    // them as status_error which causes directory_entry caching to call status() +    // and symlink_status() which do handle reparse points fully +    { +      sf.type(fs::status_error); +      symlink_sf.type(fs::status_error); +    }      else -      { sf.type(fs::regular_file); symlink_sf.type(fs::regular_file); } +    { +      if (data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) +      { +        sf.type(fs::directory_file); +        symlink_sf.type(fs::directory_file); +      } +      else +      { +        sf.type(fs::regular_file); +        symlink_sf.type(fs::regular_file); +      } +      sf.permissions(make_permissions(data.cFileName, data.dwFileAttributes)); +      symlink_sf.permissions(sf.permissions()); +    }      return error_code();    } @@ -1829,12 +2066,28 @@ namespace      }      target = data.cFileName;      if (data.dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT) -      // reparse points are complex, so don't try to handle them here -      { sf.type(fs::status_error); symlink_sf.type(fs::status_error); } -    else if (data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) -      { sf.type(fs::directory_file); symlink_sf.type(fs::directory_file); } +    // reparse points are complex, so don't try to handle them here; instead just mark +    // them as status_error which causes directory_entry caching to call status() +    // and symlink_status() which do handle reparse points fully +    { +      sf.type(fs::status_error); +      symlink_sf.type(fs::status_error); +    }      else -      { sf.type(fs::regular_file); symlink_sf.type(fs::regular_file); } +    { +      if (data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) +      { +        sf.type(fs::directory_file); +        symlink_sf.type(fs::directory_file); +      } +      else +      { +        sf.type(fs::regular_file); +        symlink_sf.type(fs::regular_file); +      } +      sf.permissions(make_permissions(data.cFileName, data.dwFileAttributes)); +      symlink_sf.permissions(sf.permissions()); +    }      return error_code();    }  #endif @@ -1851,7 +2104,7 @@ namespace  namespace boost  { -namespace filesystem3 +namespace filesystem  {  namespace detail @@ -1889,7 +2142,8 @@ namespace detail      const path& p, system::error_code* ec)        {      if (error(p.empty(), not_found_error_code, p, ec, -       "boost::filesystem::directory_iterator::construct"))return; +              "boost::filesystem::directory_iterator::construct")) +      return;      path::string_type filename;      file_status file_stat, symlink_file_stat; @@ -1907,24 +2161,24 @@ namespace detail        return;      } -    if (it.m_imp->handle == 0)it.m_imp.reset(); // eof, so make end iterator +    if (it.m_imp->handle == 0) +      it.m_imp.reset(); // eof, so make end iterator      else // not eof      { -      it.m_imp->dir_entry.assign(p / filename, -        file_stat, symlink_file_stat); +      it.m_imp->dir_entry.assign(p / filename, file_stat, symlink_file_stat);        if (filename[0] == dot // dot or dot-dot          && (filename.size()== 1            || (filename[1] == dot              && filename.size()== 2))) -        {  it.increment(); } +        {  it.increment(*ec); }      }    }    void directory_iterator_increment(directory_iterator& it,      system::error_code* ec)    { -    BOOST_ASSERT(it.m_imp.get() && "attempt to increment end iterator"); -    BOOST_ASSERT(it.m_imp->handle != 0 && "internal program error"); +    BOOST_ASSERT_MSG(it.m_imp.get(), "attempt to increment end iterator"); +    BOOST_ASSERT_MSG(it.m_imp->handle != 0, "internal program error");      path::string_type filename;      file_status file_stat, symlink_file_stat; @@ -1938,13 +2192,14 @@ namespace detail  #       endif          filename, file_stat, symlink_file_stat); -      if (temp_ec) +      if (temp_ec)  // happens if filesystem is corrupt, such as on a damaged optical disc        { +        path error_path(it.m_imp->dir_entry.path().parent_path());  // fix ticket #5900          it.m_imp.reset();          if (ec == 0)            BOOST_FILESYSTEM_THROW(              filesystem_error("boost::filesystem::directory_iterator::operator++", -              it.m_imp->dir_entry.path().parent_path(), +              error_path,                error_code(BOOST_ERRNO, system_category())));          ec->assign(BOOST_ERRNO, system_category());          return; @@ -1969,7 +2224,5 @@ namespace detail      }    }  }  // namespace detail -} // namespace filesystem3 +} // namespace filesystem  } // namespace boost - -#endif  // no wide character support diff --git a/3rdParty/Boost/src/libs/filesystem/v3/src/path.cpp b/3rdParty/Boost/src/libs/filesystem/src/path.cpp index cc30570..c740dec 100644 --- a/3rdParty/Boost/src/libs/filesystem/v3/src/path.cpp +++ b/3rdParty/Boost/src/libs/filesystem/src/path.cpp @@ -7,12 +7,12 @@  //  Library home page: http://www.boost.org/libs/filesystem +//  Old standard library configurations, particularly MingGW, don't support wide strings. +//  Report this with an explicit error message.  #include <boost/config.hpp> -#if !defined( BOOST_NO_STD_WSTRING ) -// Boost.Filesystem V3 and later requires std::wstring support. -// During the transition to V3, libraries are compiled with both V2 and V3 sources. -// On old compilers that don't support V3 anyhow, we just skip everything so the compile -// will succeed and the library can be built. +# if defined( BOOST_NO_STD_WSTRING ) +#   error Configuration not supported: Boost.Filesystem V3 and later requires std::wstring support +# endif  // define BOOST_FILESYSTEM_SOURCE so that <boost/system/config.hpp> knows  // the library is being built (possibly exporting rather than importing code) @@ -22,8 +22,8 @@  # define BOOST_SYSTEM_NO_DEPRECATED  #endif -#include <boost/filesystem/v3/config.hpp> -#include <boost/filesystem/v3/path.hpp> +#include <boost/filesystem/config.hpp> +#include <boost/filesystem/path.hpp>  #include <boost/scoped_array.hpp>  #include <boost/system/error_code.hpp>  #include <boost/assert.hpp> @@ -44,9 +44,9 @@  # include <iomanip>  #endif -namespace fs = boost::filesystem3; +namespace fs = boost::filesystem; -using boost::filesystem3::path; +using boost::filesystem::path;  using std::string;  using std::wstring; @@ -78,19 +78,23 @@ namespace  # ifdef BOOST_WINDOWS_API    const wchar_t separator = L'/'; -  const wchar_t preferred_separator = L'\\';    const wchar_t* const separators = L"/\\";    const wchar_t* separator_string = L"/";    const wchar_t* preferred_separator_string = L"\\";    const wchar_t colon = L':';    const wchar_t dot = L'.'; +  const wchar_t questionmark = L'?';    const fs::path dot_path(L".");    const fs::path dot_dot_path(L".."); +  inline bool is_letter(wchar_t c) +  { +    return (c >= L'a' && c <=L'z') || (c >= L'A' && c <=L'Z'); +  } +  # else    const char separator = '/'; -  const char preferred_separator = '/';    const char* const separators = "/";    const char* separator_string = "/";    const char* preferred_separator_string = "/"; @@ -105,12 +109,12 @@ namespace    {      return c == separator  #     ifdef BOOST_WINDOWS_API -      || c == preferred_separator +      || c == path::preferred_separator  #     endif        ;    } -  bool is_non_root_separator(const string_type& str, size_type pos); +  bool is_root_separator(const string_type& str, size_type pos);      // pos is position of the separator    size_type filename_pos(const string_type& str, @@ -141,32 +145,67 @@ namespace  namespace boost  { -namespace filesystem3 +namespace filesystem  { - -  path & path::operator/=(const path & p) +  path& path::operator/=(const path& p)    {      if (p.empty())        return *this; -    if (!is_separator(*p.m_pathname.begin())) -      m_append_separator_if_needed(); -    m_pathname += p.m_pathname; +    if (this == &p)  // self-append +    { +      path rhs(p); +      if (!is_separator(rhs.m_pathname[0])) +        m_append_separator_if_needed(); +      m_pathname += rhs.m_pathname; +    } +    else +    { +      if (!is_separator(*p.m_pathname.begin())) +        m_append_separator_if_needed(); +      m_pathname += p.m_pathname; +    }      return *this;    } +  path& path::operator/=(const value_type* ptr) +  { +    if (!*ptr) +      return *this; +    if (ptr >= m_pathname.data() +      && ptr < m_pathname.data() + m_pathname.size())  // overlapping source +    { +      path rhs(ptr); +      if (!is_separator(rhs.m_pathname[0])) +        m_append_separator_if_needed(); +      m_pathname += rhs.m_pathname; +    } +    else +    { +      if (!is_separator(*ptr)) +        m_append_separator_if_needed(); +      m_pathname += ptr; +    } +    return *this; +  } + +  int path::compare(const path& p) const BOOST_NOEXCEPT +  { +    return detail::lex_compare(begin(), end(), p.begin(), p.end()); +  } +  # ifdef BOOST_WINDOWS_API    const std::string path::generic_string(const codecvt_type& cvt) const    {       path tmp(*this); -    tmp.make_preferred(); +    std::replace(tmp.m_pathname.begin(), tmp.m_pathname.end(), L'\\', L'/');      return tmp.string(cvt);    }    const std::wstring path::generic_wstring() const    {       path tmp(*this); -    tmp.make_preferred(); +    std::replace(tmp.m_pathname.begin(), tmp.m_pathname.end(), L'\\', L'/');      return tmp.wstring();    } @@ -207,7 +246,7 @@ namespace filesystem3  # ifdef BOOST_WINDOWS_API    path & path::make_preferred()    { -    std::replace(m_pathname.begin(), m_pathname.end(), L'\\', L'/'); +    std::replace(m_pathname.begin(), m_pathname.end(), L'/', L'\\');      return *this;    }  # endif @@ -218,17 +257,18 @@ namespace filesystem3      return *this;    } -  path & path::replace_extension(const path & source) +  path& path::replace_extension(const path& new_extension)    { -    // erase existing extension if any -    size_type pos(m_pathname.rfind(dot)); -    if (pos != string_type::npos && pos >= filename_pos(m_pathname, m_pathname.size())) -      m_pathname.erase(pos); +    // erase existing extension, including the dot, if any +    m_pathname.erase(m_pathname.size()-extension().m_pathname.size()); -    // append source extension if any -    pos = source.m_pathname.rfind(dot); -    if (pos != string_type::npos) -      m_pathname += source.c_str() + pos; +    if (!new_extension.empty()) +    { +      // append new_extension, adding the dot if necessary +      if (new_extension.m_pathname[0] != dot) +        m_pathname.push_back(dot); +      m_pathname.append(new_extension.m_pathname); +    }      return *this;    } @@ -318,7 +358,7 @@ namespace filesystem3      return (m_pathname.size()                && pos                && is_separator(m_pathname[pos]) -              && is_non_root_separator(m_pathname, pos)) +              && !is_root_separator(m_pathname, pos))        ? dot_path        : path(m_pathname.c_str() + pos);    } @@ -410,7 +450,7 @@ namespace filesystem3      return *this;    } -}  // namespace filesystem3 +}  // namespace filesystem  }  // namespace boost  //--------------------------------------------------------------------------------------// @@ -422,25 +462,33 @@ namespace filesystem3  namespace  { -  //  is_non_root_separator  -------------------------------------------------// +  //  is_root_separator  ---------------------------------------------------------------// -  bool is_non_root_separator(const string_type & str, size_type pos) +  bool is_root_separator(const string_type & str, size_type pos)      // pos is position of the separator    { -    BOOST_ASSERT(!str.empty() && is_separator(str[pos]) -      && "precondition violation"); +    BOOST_ASSERT_MSG(!str.empty() && is_separator(str[pos]), +      "precondition violation");      // subsequent logic expects pos to be for leftmost slash of a set      while (pos > 0 && is_separator(str[pos-1]))        --pos; -    return  pos != 0 -      && (pos <= 2 || !is_separator(str[1]) -        || str.find_first_of(separators, 2) != pos) -#     ifdef BOOST_WINDOWS_API -      && (pos !=2 || str[1] != colon) -#     endif -        ; +    //  "/" [...] +    if (pos == 0)   +      return true; + +# ifdef BOOST_WINDOWS_API +    //  "c:/" [...] +    if (pos == 2 && is_letter(str[0]) && str[1] == colon)   +      return true; +# endif + +    //  "//" name "/" +    if (pos < 3 || !is_separator(str[0]) || !is_separator(str[1])) +      return false; + +    return str.find_first_of(separators, 2) == pos;    }    //  filename_pos  --------------------------------------------------------------------// @@ -490,6 +538,19 @@ namespace        && is_separator(path[0])        && is_separator(path[1])) return string_type::npos; +#   ifdef BOOST_WINDOWS_API +    // case "\\?\" +    if (size > 4 +      && is_separator(path[0]) +      && is_separator(path[1]) +      && path[2] == questionmark +      && is_separator(path[3])) +    { +      string_type::size_type pos(path.find_first_of(separators, 4)); +        return pos < size ? pos : string_type::npos; +    } +#   endif +      // case "//net {/}"      if (size > 3        && is_separator(path[0]) @@ -572,7 +633,32 @@ namespace      return;    } -}  // unnammed namespace +}  // unnamed namespace + + +namespace boost +{ +namespace filesystem +{ +  namespace detail +  { +    BOOST_FILESYSTEM_DECL +      int lex_compare(path::iterator first1, path::iterator last1, +        path::iterator first2, path::iterator last2) +    { +      for (; first1 != last1 && first2 != last2;) +      { +        if (first1->native() < first2->native()) return -1; +        if (first2->native() < first1->native()) return 1; +        BOOST_ASSERT(first2->native() == first1->native()); +        ++first1; +        ++first2; +      } +      if (first1 == last1 && first2 == last2) +        return 0; +      return first1 == last1 ? -1 : 1; +    } +  }  //--------------------------------------------------------------------------------------//  //                                                                                      // @@ -580,11 +666,6 @@ namespace  //                                                                                      //  //--------------------------------------------------------------------------------------// -namespace boost -{ -namespace filesystem3 -{ -    path::iterator path::begin() const    {      iterator itr; @@ -607,15 +688,17 @@ namespace filesystem3    void path::m_path_iterator_increment(path::iterator & it)    { -    BOOST_ASSERT(it.m_pos < it.m_path_ptr->m_pathname.size() && "path::basic_iterator increment past end()"); +    BOOST_ASSERT_MSG(it.m_pos < it.m_path_ptr->m_pathname.size(), +      "path::basic_iterator increment past end()"); -    // increment to position past current element +    // increment to position past current element; if current element is implicit dot, +    // this will cause it.m_pos to represent the end iterator      it.m_pos += it.m_element.m_pathname.size(); -    // if end reached, create end basic_iterator +    // if the end is reached, we are done      if (it.m_pos == it.m_path_ptr->m_pathname.size())      { -      it.m_element.clear();  +      it.m_element.clear();  // aids debugging, may release unneeded memory        return;      } @@ -636,18 +719,18 @@ namespace filesystem3  #       endif           )        { -        it.m_element.m_pathname = separator; +        it.m_element.m_pathname = separator;  // generic format; see docs          return;        } -      // bypass separators +      // skip separators until it.m_pos points to the start of the next element        while (it.m_pos != it.m_path_ptr->m_pathname.size()          && is_separator(it.m_path_ptr->m_pathname[it.m_pos]))          { ++it.m_pos; }        // detect trailing separator, and treat it as ".", per POSIX spec        if (it.m_pos == it.m_path_ptr->m_pathname.size() -        && is_non_root_separator(it.m_path_ptr->m_pathname, it.m_pos-1))  +        && !is_root_separator(it.m_path_ptr->m_pathname, it.m_pos-1))         {          --it.m_pos;          it.m_element = dot_path; @@ -655,15 +738,16 @@ namespace filesystem3        }      } -    // get next element +    // get m_element      size_type end_pos(it.m_path_ptr->m_pathname.find_first_of(separators, it.m_pos)); -    if (end_pos == string_type::npos) end_pos = it.m_path_ptr->m_pathname.size(); +    if (end_pos == string_type::npos) +      end_pos = it.m_path_ptr->m_pathname.size();      it.m_element = it.m_path_ptr->m_pathname.substr(it.m_pos, end_pos - it.m_pos);    }    void path::m_path_iterator_decrement(path::iterator & it)    { -    BOOST_ASSERT(it.m_pos && "path::iterator decrement past begin()"); +    BOOST_ASSERT_MSG(it.m_pos, "path::iterator decrement past begin()");      size_type end_pos(it.m_pos); @@ -671,7 +755,7 @@ namespace filesystem3      if (it.m_pos == it.m_path_ptr->m_pathname.size()        && it.m_path_ptr->m_pathname.size() > 1        && is_separator(it.m_path_ptr->m_pathname[it.m_pos-1]) -      && is_non_root_separator(it.m_path_ptr->m_pathname, it.m_pos-1)  +      && !is_root_separator(it.m_path_ptr->m_pathname, it.m_pos-1)          )      {        --it.m_pos; @@ -692,11 +776,11 @@ namespace filesystem3      it.m_pos = filename_pos(it.m_path_ptr->m_pathname, end_pos);      it.m_element = it.m_path_ptr->m_pathname.substr(it.m_pos, end_pos - it.m_pos); -    if (it.m_element.m_pathname == preferred_separator_string) -      it.m_element.m_pathname = separator_string;  // needed for Windows, harmless on POSIX +    if (it.m_element.m_pathname == preferred_separator_string) // needed for Windows, harmless on POSIX  +      it.m_element.m_pathname = separator_string;    // generic format; see docs     } -}  // namespace filesystem3 +}  // namespace filesystem  }  // namespace boost  //--------------------------------------------------------------------------------------// @@ -712,51 +796,80 @@ namespace    //                              locale helpers                                        //    //------------------------------------------------------------------------------------// -  // std::locale construction can throw (if LC_MESSAGES is wrong, for example), -  // so a static at function scope is used to ensure that exceptions can be -  // caught. (A previous version was at namespace scope, so initialization -  // occurred before main(), preventing exceptions from being caught.) +#if defined(BOOST_WINDOWS_API) && defined(BOOST_FILESYSTEM_STATIC_LINK) -  std::locale default_locale() +  inline std::locale default_locale()    { -#   ifdef BOOST_WINDOWS_API      std::locale global_loc = std::locale();      std::locale loc(global_loc, new windows_file_codecvt);      return loc; - -#   elif defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__) -    // "All BSD system functions expect their string parameters to be in UTF-8 encoding -    // and nothing else." http://developer.apple.com/mac/library/documentation/MacOSX/Conceptual/BPInternational/Articles/FileEncodings.html -    // -    // "The kernel will reject any filename that is not a valid UTF-8 string, and it will -    // even be normalized (to Unicode NFD) before stored on disk, at least when using HFS. -    // The right way to deal with it would be to always convert the filename to UTF-8 -    // before trying to open/create a file." http://lists.apple.com/archives/unix-porting/2007/Sep/msg00023.html -    // -    // "How a file name looks at the API level depends on the API. Current Carbon APIs -    // handle file names as an array of UTF-16 characters; POSIX ones handle them as an -    // array of UTF-8, which is why UTF-8 works well in Terminal. How it's stored on disk -    // depends on the disk format; HFS+ uses UTF-16, but that's not important in most -    // cases." http://lists.apple.com/archives/applescript-users/2002/Sep/msg00319.html -    // -    // Many thanks to Peter Dimov for digging out the above references! -    std::locale global_loc = std::locale(); -    std::locale loc(global_loc, new boost::filesystem::detail::utf8_codecvt_facet); -    return loc; - -#   else -    // ISO C calls this "the locale-specific native environment": -    return std::locale(""); - -#   endif    } -  std::locale & path_locale() +  inline std::locale& path_locale()    {      static std::locale loc(default_locale());      return loc;    } +  inline const path::codecvt_type*& codecvt_facet_ptr() +  { +    static const std::codecvt<wchar_t, char, std::mbstate_t>* +     facet( +       &std::use_facet<std::codecvt<wchar_t, char, std::mbstate_t> > +        (path_locale())); +    return facet; +  } + +#elif defined(BOOST_WINDOWS_API) && !defined(BOOST_FILESYSTEM_STATIC_LINK) + +  std::locale path_locale(std::locale(), new windows_file_codecvt);  + +  const std::codecvt<wchar_t, char, std::mbstate_t>* +    codecvt_facet_ptr(&std::use_facet<std::codecvt<wchar_t, char, std::mbstate_t> > +      (path_locale)); + +#elif defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__) + +  // "All BSD system functions expect their string parameters to be in UTF-8 encoding +  // and nothing else." See +  // http://developer.apple.com/mac/library/documentation/MacOSX/Conceptual/BPInternational/Articles/FileEncodings.html +  // +  // "The kernel will reject any filename that is not a valid UTF-8 string, and it will +  // even be normalized (to Unicode NFD) before stored on disk, at least when using HFS. +  // The right way to deal with it would be to always convert the filename to UTF-8 +  // before trying to open/create a file." See +  // http://lists.apple.com/archives/unix-porting/2007/Sep/msg00023.html +  // +  // "How a file name looks at the API level depends on the API. Current Carbon APIs +  // handle file names as an array of UTF-16 characters; POSIX ones handle them as an +  // array of UTF-8, which is why UTF-8 works well in Terminal. How it's stored on disk +  // depends on the disk format; HFS+ uses UTF-16, but that's not important in most +  // cases." See +  // http://lists.apple.com/archives/applescript-users/2002/Sep/msg00319.html +  // +  // Many thanks to Peter Dimov for digging out the above references! + +  std::locale path_locale(std::locale(), +                          new boost::filesystem::detail::utf8_codecvt_facet); + +  const std::codecvt<wchar_t, char, std::mbstate_t>* +    codecvt_facet_ptr(&std::use_facet<std::codecvt<wchar_t, char, std::mbstate_t> > +      (path_locale)); + +#else  // Other POSIX + +  // ISO C calls std::locale("") "the locale-specific native environment", and this +  // locale is the default for many POSIX-based operating systems such as Linux. + +  // std::locale("") construction can throw (if environmental variables LC_MESSAGES or +  // or LANG are wrong, for example), so lazy initialization is used to ensure +  // that exceptions occur after main() starts and so can be caught. + +  std::locale path_locale;  // initialized by path::codecvt() below +  const std::codecvt<wchar_t, char, std::mbstate_t>* codecvt_facet_ptr;  // ditto + +# endif +  }  // unnamed namespace  //--------------------------------------------------------------------------------------// @@ -765,29 +878,52 @@ namespace  namespace boost  { -namespace filesystem3 +namespace filesystem  { -  const path::codecvt_type *& -    path::wchar_t_codecvt_facet() +#if defined(BOOST_WINDOWS_API) && defined(BOOST_FILESYSTEM_STATIC_LINK) + +  const path::codecvt_type& path::codecvt()    { -   static const std::codecvt<wchar_t, char, std::mbstate_t> * -     facet( -       &std::use_facet<std::codecvt<wchar_t, char, std::mbstate_t> > -        (path_locale())); -   return facet; +    BOOST_ASSERT_MSG(codecvt_facet_ptr(), "codecvt_facet_ptr() facet hasn't been properly initialized"); +    return *codecvt_facet_ptr();    }    std::locale path::imbue(const std::locale & loc)    {      std::locale temp(path_locale());      path_locale() = loc; -    wchar_t_codecvt_facet() = &std::use_facet -        <std::codecvt<wchar_t, char, std::mbstate_t> >(path_locale()); +    codecvt_facet_ptr() = +      &std::use_facet<std::codecvt<wchar_t, char, std::mbstate_t> >(path_locale());      return temp;    } -}  // namespace filesystem3 -}  // namespace boost +#else + +  const path::codecvt_type& path::codecvt() +  { +#   if defined(BOOST_POSIX_API) && \ +      !(defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__)) +      // A local static initialized by calling path::imbue ensures that std::locale(""), +      // which may throw, is called only if path_locale and condecvt_facet will actually +      // be used. Thus misconfigured environmental variables will only cause an +      // exception if a valid std::locale("") is actually needed. +      static std::locale posix_lazy_initialization(path::imbue(std::locale(""))); +#   endif +    return *codecvt_facet_ptr; +  } -#endif  // no wide character support +  std::locale path::imbue(const std::locale& loc) +  { +    std::locale temp(path_locale); +    path_locale = loc; +    codecvt_facet_ptr = +      &std::use_facet<std::codecvt<wchar_t, char, std::mbstate_t> >(path_locale); +    return temp; +  } + + +#endif + +}  // namespace filesystem +}  // namespace boost diff --git a/3rdParty/Boost/src/libs/filesystem/v3/src/path_traits.cpp b/3rdParty/Boost/src/libs/filesystem/src/path_traits.cpp index 6606437..06ac798 100644 --- a/3rdParty/Boost/src/libs/filesystem/v3/src/path_traits.cpp +++ b/3rdParty/Boost/src/libs/filesystem/src/path_traits.cpp @@ -9,13 +9,6 @@  //--------------------------------------------------------------------------------------// -#include <boost/config.hpp> -#if !defined( BOOST_NO_STD_WSTRING ) -// Boost.Filesystem V3 and later requires std::wstring support. -// During the transition to V3, libraries are compiled with both V2 and V3 sources. -// On old compilers that don't support V3 anyhow, we just skip everything so the compile -// will succeed and the library can be built. -  // define BOOST_FILESYSTEM_SOURCE so that <boost/system/config.hpp> knows  // the library is being built (possibly exporting rather than importing code)  #define BOOST_FILESYSTEM_SOURCE  @@ -24,16 +17,16 @@  # define BOOST_SYSTEM_NO_DEPRECATED  #endif -#include <boost/filesystem/v3/config.hpp> -#include <boost/filesystem/v3/path_traits.hpp> +#include <boost/filesystem/config.hpp> +#include <boost/filesystem/path_traits.hpp>  #include <boost/system/system_error.hpp>  #include <boost/scoped_array.hpp>  #include <locale>   // for codecvt_base::result  #include <cstring>  // for strlen  #include <cwchar>   // for wcslen -namespace pt = boost::filesystem3::path_traits; -namespace fs = boost::filesystem3; +namespace pt = boost::filesystem::path_traits; +namespace fs = boost::filesystem;  namespace bs = boost::system;  //--------------------------------------------------------------------------------------// @@ -130,7 +123,7 @@ namespace {  //                                   path_traits                                        //  //--------------------------------------------------------------------------------------// -namespace boost { namespace filesystem3 { namespace path_traits { +namespace boost { namespace filesystem { namespace path_traits {  //--------------------------------------------------------------------------------------//  //                          convert const char* to wstring                             // @@ -204,6 +197,4 @@ namespace boost { namespace filesystem3 { namespace path_traits {        convert_aux(from, from_end, buf, buf+default_codecvt_buf_size, to, cvt);      }    } -}}} // namespace boost::filesystem3::path_traits - -#endif  // no wide character support +}}} // namespace boost::filesystem::path_traits diff --git a/3rdParty/Boost/src/libs/filesystem/v3/src/portability.cpp b/3rdParty/Boost/src/libs/filesystem/src/portability.cpp index 31e0176..b1a1352 100644 --- a/3rdParty/Boost/src/libs/filesystem/v3/src/portability.cpp +++ b/3rdParty/Boost/src/libs/filesystem/src/portability.cpp @@ -9,13 +9,6 @@  //--------------------------------------------------------------------------------------//  -#include <boost/config.hpp> -#if !defined( BOOST_NO_STD_WSTRING ) -// Boost.Filesystem V3 and later requires std::wstring support. -// During the transition to V3, libraries are compiled with both V2 and V3 sources. -// On old compilers that don't support V3 anyhow, we just skip everything so the compile -// will succeed and the library can be built. -  // define BOOST_FILESYSTEM_SOURCE so that <boost/filesystem/config.hpp> knows  // the library is being built (possibly exporting rather than importing code)  #define BOOST_FILESYSTEM_SOURCE  @@ -24,10 +17,10 @@  # define BOOST_SYSTEM_NO_DEPRECATED  #endif -#include <boost/filesystem/v3/config.hpp> -#include <boost/filesystem/v3/path.hpp> +#include <boost/filesystem/config.hpp> +#include <boost/filesystem/path.hpp> -namespace fs = boost::filesystem3; +namespace fs = boost::filesystem;  #include <cstring> // SGI MIPSpro compilers need this @@ -54,7 +47,7 @@ namespace  namespace boost  { -  namespace filesystem3 +  namespace filesystem    {      //  name_check functions  ----------------------------------------------// @@ -122,7 +115,5 @@ namespace boost          ;      } -  } // namespace filesystem3 +  } // namespace filesystem  } // namespace boost - -#endif  // no wide character support diff --git a/3rdParty/Boost/src/libs/filesystem/v3/src/unique_path.cpp b/3rdParty/Boost/src/libs/filesystem/src/unique_path.cpp index 1569b32..c25c315 100644 --- a/3rdParty/Boost/src/libs/filesystem/v3/src/unique_path.cpp +++ b/3rdParty/Boost/src/libs/filesystem/src/unique_path.cpp @@ -1,4 +1,4 @@ -//  filesystem system_crypt_random.cpp  ------------------------------------------------// +//  filesystem unique_path.cpp  --------------------------------------------------------//  //  Copyright Beman Dawes 2010 @@ -9,13 +9,6 @@  //--------------------------------------------------------------------------------------//  -#include <boost/config.hpp> -#if !defined( BOOST_NO_STD_WSTRING ) -// Boost.Filesystem V3 and later requires std::wstring support. -// During the transition to V3, libraries are compiled with both V2 and V3 sources. -// On old compilers that don't support V3 anyhow, we just skip everything so the compile -// will succeed and the library can be built. -  // define BOOST_FILESYSTEM_SOURCE so that <boost/filesystem/config.hpp> knows  // the library is being built (possibly exporting rather than importing code)  #define BOOST_FILESYSTEM_SOURCE  @@ -24,7 +17,7 @@  # define BOOST_SYSTEM_NO_DEPRECATED  #endif -#include <boost/filesystem/v3/operations.hpp> +#include <boost/filesystem/operations.hpp>  # ifdef BOOST_POSIX_API  #   include <fcntl.h> @@ -112,7 +105,7 @@ void system_crypt_random(void* buf, std::size_t len, boost::system::error_code*  }  // unnamed namespace -namespace boost { namespace filesystem3 { namespace detail { +namespace boost { namespace filesystem { namespace detail {  BOOST_FILESYSTEM_DECL  path unique_path(const path& model, system::error_code* ec) @@ -147,5 +140,3 @@ path unique_path(const path& model, system::error_code* ec)  }  }}} - -#endif  // no wide character support diff --git a/3rdParty/Boost/src/libs/filesystem/v3/src/windows_file_codecvt.cpp b/3rdParty/Boost/src/libs/filesystem/src/windows_file_codecvt.cpp index ae9f9f2..998db60 100644 --- a/3rdParty/Boost/src/libs/filesystem/v3/src/windows_file_codecvt.cpp +++ b/3rdParty/Boost/src/libs/filesystem/src/windows_file_codecvt.cpp @@ -9,13 +9,6 @@  //--------------------------------------------------------------------------------------//  -#include <boost/config.hpp> -#if !defined( BOOST_NO_STD_WSTRING ) -// Boost.Filesystem V3 and later requires std::wstring support. -// During the transition to V3, libraries are compiled with both V2 and V3 sources. -// On old compilers that don't support V3 anyhow, we just skip everything so the compile -// will succeed and the library can be built. -  // define BOOST_FILESYSTEM_SOURCE so that <boost/system/config.hpp> knows  // the library is being built (possibly exporting rather than importing code)  #define BOOST_FILESYSTEM_SOURCE  @@ -24,7 +17,7 @@  # define BOOST_SYSTEM_NO_DEPRECATED  #endif -#include <boost/filesystem/v3/config.hpp> +#include <boost/filesystem/config.hpp>  #include <cwchar>  // for mbstate_t  #ifdef BOOST_WINDOWS_API @@ -43,7 +36,7 @@      const char* from, const char* from_end, const char*& from_next,      wchar_t* to, wchar_t* to_end, wchar_t*& to_next) const    { -    UINT codepage = AreFileApisANSI() ? CP_THREAD_ACP : CP_OEMCP; +    UINT codepage = AreFileApisANSI() ? CP_ACP : CP_OEMCP;      int count;      if ((count = ::MultiByteToWideChar(codepage, MB_PRECOMPOSED, from, @@ -63,7 +56,7 @@      const wchar_t* from, const wchar_t* from_end, const wchar_t*  & from_next,      char* to, char* to_end, char* & to_next) const    { -    UINT codepage = AreFileApisANSI() ? CP_THREAD_ACP : CP_OEMCP; +    UINT codepage = AreFileApisANSI() ? CP_ACP : CP_OEMCP;      int count;      if ((count = ::WideCharToMultiByte(codepage, WC_NO_BEST_FIT_CHARS, from, @@ -80,4 +73,3 @@    # endif  // BOOST_WINDOWS_API -#endif  // no wide character support diff --git a/3rdParty/Boost/src/libs/filesystem/v3/src/windows_file_codecvt.hpp b/3rdParty/Boost/src/libs/filesystem/src/windows_file_codecvt.hpp index d845d37..52deab1 100644 --- a/3rdParty/Boost/src/libs/filesystem/v3/src/windows_file_codecvt.hpp +++ b/3rdParty/Boost/src/libs/filesystem/src/windows_file_codecvt.hpp @@ -10,7 +10,7 @@  #ifndef BOOST_FILESYSTEM3_WIN_FILE_CODECVT_HPP  #define BOOST_FILESYSTEM3_WIN_FILE_CODECVT_HPP -#include <boost/filesystem/v3/config.hpp> +#include <boost/filesystem/config.hpp>  #include <locale>      //------------------------------------------------------------------------------------// diff --git a/3rdParty/Boost/src/libs/filesystem/v2/src/v2_operations.cpp b/3rdParty/Boost/src/libs/filesystem/v2/src/v2_operations.cpp deleted file mode 100644 index f29153c..0000000 --- a/3rdParty/Boost/src/libs/filesystem/v2/src/v2_operations.cpp +++ /dev/null @@ -1,1372 +0,0 @@ -//  operations.cpp  ----------------------------------------------------------// - -//  Copyright 2002-2005 Beman Dawes -//  Copyright 2001 Dietmar Kuehl -//  Use, modification, and distribution is subject to the Boost Software -//  License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy -//  at http://www.boost.org/LICENSE_1_0.txt) - -//  See library home page at http://www.boost.org/libs/filesystem - -//----------------------------------------------------------------------------//  - -// define BOOST_FILESYSTEM_SOURCE so that <boost/filesystem/config.hpp> knows -// the library is being built (possibly exporting rather than importing code) -#define BOOST_FILESYSTEM_SOURCE - -#ifndef BOOST_SYSTEM_NO_DEPRECATED  -# define BOOST_SYSTEM_NO_DEPRECATED -#endif - -#define _POSIX_PTHREAD_SEMANTICS  // Sun readdir_r() needs this - -#if !(defined(__HP_aCC) && defined(_ILP32) && \ -      !defined(_STATVFS_ACPP_PROBLEMS_FIXED)) -#define _FILE_OFFSET_BITS 64 // at worst, these defines may have no effect, -#endif -#define __USE_FILE_OFFSET64 // but that is harmless on Windows and on POSIX -      // 64-bit systems or on 32-bit systems which don't have files larger  -      // than can be represented by a traditional POSIX/UNIX off_t type.  -      // OTOH, defining them should kick in 64-bit off_t's (and thus  -      // st_size) on 32-bit systems that provide the Large File -      // Support (LFS) interface, such as Linux, Solaris, and IRIX. -      // The defines are given before any headers are included to -      // ensure that they are available to all included headers. -      // That is required at least on Solaris, and possibly on other -      // systems as well. - -// for some compilers (CodeWarrior, for example), windows.h -// is getting included by some other boost header, so do this early: -#if !defined(_WIN32_WINNT) -#define _WIN32_WINNT 0x0500 // Default to Windows 2K or later -#endif - - -#include <boost/filesystem/v2/operations.hpp> -#include <boost/scoped_array.hpp> -#include <boost/assert.hpp> -#include <boost/detail/workaround.hpp> -#include <cstdlib>  // for malloc, free - -namespace fs = boost::filesystem2; -using boost::system::error_code; -using boost::system::system_category; - -# if defined(BOOST_WINDOWS_API) -#   include <windows.h> -#   include <ctime>  // for time_t - -# else // BOOST_POSIX_API -#   include <sys/types.h> -#   if !defined(__APPLE__) && !defined(__OpenBSD__) -#     include <sys/statvfs.h> -#     define BOOST_STATVFS statvfs -#     define BOOST_STATVFS_F_FRSIZE vfs.f_frsize -#   else -#ifdef __OpenBSD__ -#     include <sys/param.h> -#endif -#     include <sys/mount.h> -#     define BOOST_STATVFS statfs -#     define BOOST_STATVFS_F_FRSIZE static_cast<boost::uintmax_t>( vfs.f_bsize ) -#   endif -#   include <dirent.h> -#   include <unistd.h> -#   include <fcntl.h> -#   include <utime.h> -#   include "limits.h" -# endif - -//  BOOST_FILESYSTEM_STATUS_CACHE enables file_status cache in -//  dir_itr_increment. The config tests are placed here because some of the -//  macros being tested come from dirent.h. -// -// TODO: find out what macros indicate dirent::d_type present in more libraries -# if defined(BOOST_WINDOWS_API) \ -  || (defined(_DIRENT_HAVE_D_TYPE) /* defined by GNU C library if d_type present */ \ -    && !(defined(__SUNPRO_CC) && !defined(__sun)))  // _DIRENT_HAVE_D_TYPE wrong for Sun compiler on Linux -#   define BOOST_FILESYSTEM_STATUS_CACHE -# endif - -#include <sys/stat.h>  // even on Windows some functions use stat() -#include <string> -#include <cstring> -#include <cstdio>      // for remove, rename -#include <cerrno> -// #include <iostream>    // for debugging only; comment out when not in use - -#ifdef BOOST_NO_STDC_NAMESPACE -namespace std { using ::strcmp; using ::remove; using ::rename; } -#endif - -//  helpers  -----------------------------------------------------------------// - -namespace -{ -  const error_code ok; - -  bool is_empty_directory( const std::string & dir_path ) -  { -    static const fs::directory_iterator end_itr; -    return fs::directory_iterator(fs::path(dir_path)) == end_itr; -  } - -#ifdef BOOST_WINDOWS_API -   -// For Windows, the xxxA form of various function names is used to avoid -// inadvertently getting wide forms of the functions. (The undecorated -// forms are actually macros, so can misfire if the user has various -// other macros defined. There was a bug report of this happening.) - -  inline DWORD get_file_attributes( const char * ph ) -    { return ::GetFileAttributesA( ph ); } - -# ifndef BOOST_FILESYSTEM2_NARROW_ONLY - -  inline DWORD get_file_attributes( const wchar_t * ph ) -    { return ::GetFileAttributesW( ph ); } - -  bool is_empty_directory( const std::wstring & dir_path ) -  { -    static const fs::wdirectory_iterator wend_itr; -    return fs::wdirectory_iterator(fs::wpath(dir_path)) == wend_itr; -  } - -  inline BOOL get_file_attributes_ex( const wchar_t * ph, -    WIN32_FILE_ATTRIBUTE_DATA & fad ) -  { return ::GetFileAttributesExW( ph, ::GetFileExInfoStandard, &fad ); } -       -  HANDLE create_file( const wchar_t * ph, DWORD dwDesiredAccess, -    DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttributes, -    DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes, -    HANDLE hTemplateFile ) -  { -    return ::CreateFileW( ph, dwDesiredAccess, dwShareMode, -      lpSecurityAttributes, dwCreationDisposition, dwFlagsAndAttributes, -      hTemplateFile ); -  } - -  inline DWORD get_current_directory( DWORD sz, wchar_t * buf ) -    { return ::GetCurrentDirectoryW( sz, buf ); }  - -  inline bool set_current_directory( const wchar_t * buf ) -    { return ::SetCurrentDirectoryW( buf ) != 0 ; }  - -  inline bool get_free_disk_space( const std::wstring & ph, -    PULARGE_INTEGER avail, PULARGE_INTEGER total, PULARGE_INTEGER free ) -    { return ::GetDiskFreeSpaceExW( ph.c_str(), avail, total, free ) != 0; } - -  inline std::size_t get_full_path_name( -    const std::wstring & ph, std::size_t len, wchar_t * buf, wchar_t ** p ) -  { -    return static_cast<std::size_t>( -      ::GetFullPathNameW( ph.c_str(), -        static_cast<DWORD>(len), buf, p )); -  }  - -  inline bool remove_directory( const std::wstring & ph ) -    { return ::RemoveDirectoryW( ph.c_str() ) != 0; } - -  inline bool delete_file( const std::wstring & ph ) -    { return ::DeleteFileW( ph.c_str() ) != 0; } - -  inline bool create_directory( const std::wstring & dir ) -    {  return ::CreateDirectoryW( dir.c_str(), 0 ) != 0; } - -#if _WIN32_WINNT >= 0x500 -  inline bool create_hard_link( const std::wstring & to_ph, -    const std::wstring & from_ph ) -    {  return ::CreateHardLinkW( from_ph.c_str(), to_ph.c_str(), 0 ) != 0; } -#endif -   -# endif // ifndef BOOST_FILESYSTEM2_NARROW_ONLY - -  template< class String > -  fs::file_status status_template( const String & ph, error_code & ec ) -  { -    DWORD attr( get_file_attributes( ph.c_str() ) ); -    if ( attr == 0xFFFFFFFF ) -    { -      ec = error_code( ::GetLastError(), system_category() ); -      if ((ec.value() == ERROR_FILE_NOT_FOUND) -        || (ec.value() == ERROR_PATH_NOT_FOUND) -        || (ec.value() == ERROR_INVALID_NAME) // "tools/jam/src/:sys:stat.h", "//foo" -        || (ec.value() == ERROR_INVALID_DRIVE) // USB card reader with no card inserted -        || (ec.value() == ERROR_NOT_READY) // CD/DVD drive with no disc inserted -        || (ec.value() == ERROR_INVALID_PARAMETER) // ":sys:stat.h" -        || (ec.value() == ERROR_BAD_PATHNAME) // "//nosuch" on Win64 -        || (ec.value() == ERROR_BAD_NETPATH)) // "//nosuch" on Win32 -      { -        ec = ok; // these are not considered errors; -                           // the status is considered not found -        return fs::file_status( fs::file_not_found ); -      } -      else if ((ec.value() == ERROR_SHARING_VIOLATION)) -      { -        ec = ok; // these are not considered errors; -                           // the file exists but the type is not known  -        return fs::file_status( fs::type_unknown ); -      } -      return fs::file_status( fs::status_unknown ); -    } -    ec = ok;; -    return (attr & FILE_ATTRIBUTE_DIRECTORY) -      ? fs::file_status( fs::directory_file ) -      : fs::file_status( fs::regular_file ); -  } - -  BOOL get_file_attributes_ex( const char * ph, -    WIN32_FILE_ATTRIBUTE_DATA & fad ) -  { return ::GetFileAttributesExA( ph, ::GetFileExInfoStandard, &fad ); } - -  template< class String > -  boost::filesystem2::detail::query_pair -  is_empty_template( const String & ph ) -  { -    WIN32_FILE_ATTRIBUTE_DATA fad; -    if ( get_file_attributes_ex( ph.c_str(), fad ) == 0 ) -      return std::make_pair( error_code( ::GetLastError(), system_category() ), false );     -    return std::make_pair( ok, -      ( fad.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY ) -        ? is_empty_directory( ph ) -        :( !fad.nFileSizeHigh && !fad.nFileSizeLow ) ); -  } - -  HANDLE create_file( const char * ph, DWORD dwDesiredAccess, -    DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttributes, -    DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes, -    HANDLE hTemplateFile ) -  { -    return ::CreateFileA( ph, dwDesiredAccess, dwShareMode, -      lpSecurityAttributes, dwCreationDisposition, dwFlagsAndAttributes, -      hTemplateFile ); -  } - -  // Thanks to Jeremy Maitin-Shepard for much help and for permission to -  // base the equivalent() implementation on portions of his  -  // file-equivalence-win32.cpp experimental code. -  struct handle_wrapper -  { -    HANDLE handle; -    handle_wrapper( HANDLE h ) -      : handle(h) {} -    ~handle_wrapper() -    { -      if ( handle != INVALID_HANDLE_VALUE ) -        ::CloseHandle(handle); -    } -  }; - -  template< class String > -  boost::filesystem2::detail::query_pair -  equivalent_template( const String & ph1, const String & ph2 ) -  { -    // Note well: Physical location on external media is part of the -    // equivalence criteria. If there are no open handles, physical location -    // can change due to defragmentation or other relocations. Thus handles -    // must be held open until location information for both paths has -    // been retrieved. -    handle_wrapper p1( -      create_file( -          ph1.c_str(), -          0, -          FILE_SHARE_DELETE | FILE_SHARE_READ | FILE_SHARE_WRITE, -          0, -          OPEN_EXISTING, -          FILE_FLAG_BACKUP_SEMANTICS, -          0 ) ); -    int error1(0); // save error code in case we have to throw -    if ( p1.handle == INVALID_HANDLE_VALUE ) -      error1 = ::GetLastError(); -    handle_wrapper p2( -      create_file( -          ph2.c_str(), -          0, -          FILE_SHARE_DELETE | FILE_SHARE_READ | FILE_SHARE_WRITE, -          0, -          OPEN_EXISTING, -          FILE_FLAG_BACKUP_SEMANTICS, -          0 ) ); -    if ( p1.handle == INVALID_HANDLE_VALUE -      || p2.handle == INVALID_HANDLE_VALUE ) -    { -      if ( p1.handle != INVALID_HANDLE_VALUE -        || p2.handle != INVALID_HANDLE_VALUE ) -        { return std::make_pair( ok, false ); } -      BOOST_ASSERT( p1.handle == INVALID_HANDLE_VALUE -        && p2.handle == INVALID_HANDLE_VALUE ); -        { return std::make_pair( error_code( error1, system_category()), false ); } -    } -    // at this point, both handles are known to be valid -    BY_HANDLE_FILE_INFORMATION info1, info2; -    if ( !::GetFileInformationByHandle( p1.handle, &info1 ) ) -      { return std::make_pair( error_code( ::GetLastError(), system_category() ), false ); } -    if ( !::GetFileInformationByHandle( p2.handle, &info2 ) ) -      { return std::make_pair( error_code( ::GetLastError(), system_category() ), false ); } -    // In theory, volume serial numbers are sufficient to distinguish between -    // devices, but in practice VSN's are sometimes duplicated, so last write -    // time and file size are also checked. -      return std::make_pair( ok, -        info1.dwVolumeSerialNumber == info2.dwVolumeSerialNumber -        && info1.nFileIndexHigh == info2.nFileIndexHigh -        && info1.nFileIndexLow == info2.nFileIndexLow -        && info1.nFileSizeHigh == info2.nFileSizeHigh -        && info1.nFileSizeLow == info2.nFileSizeLow -        && info1.ftLastWriteTime.dwLowDateTime -          == info2.ftLastWriteTime.dwLowDateTime -        && info1.ftLastWriteTime.dwHighDateTime -          == info2.ftLastWriteTime.dwHighDateTime ); -  } - -  template< class String > -  boost::filesystem2::detail::uintmax_pair -  file_size_template( const String & ph ) -  { -    WIN32_FILE_ATTRIBUTE_DATA fad; -    // by now, intmax_t is 64-bits on all Windows compilers -    if ( get_file_attributes_ex( ph.c_str(), fad ) == 0 ) -      return std::make_pair( error_code( ::GetLastError(), system_category() ), 0 );     -    if ( (fad.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) !=0 ) -      return std::make_pair( error_code( ERROR_FILE_NOT_FOUND, system_category()), 0 ); -    return std::make_pair( ok, -      (static_cast<boost::uintmax_t>(fad.nFileSizeHigh) -        << (sizeof(fad.nFileSizeLow)*8)) -      + fad.nFileSizeLow ); -  } - -  inline bool get_free_disk_space( const std::string & ph, -    PULARGE_INTEGER avail, PULARGE_INTEGER total, PULARGE_INTEGER free ) -    { return ::GetDiskFreeSpaceExA( ph.c_str(), avail, total, free ) != 0; } - -  template< class String > -  boost::filesystem2::detail::space_pair -  space_template( String & ph ) -  { -    ULARGE_INTEGER avail, total, free; -    boost::filesystem2::detail::space_pair result; -    if ( get_free_disk_space( ph, &avail, &total, &free ) ) -    { -      result.first = ok; -      result.second.capacity -        = (static_cast<boost::uintmax_t>(total.HighPart) << 32) -          + total.LowPart; -      result.second.free -        = (static_cast<boost::uintmax_t>(free.HighPart) << 32) -          + free.LowPart; -      result.second.available -        = (static_cast<boost::uintmax_t>(avail.HighPart) << 32) -          + avail.LowPart; -    } -    else -    { -      result.first = error_code( ::GetLastError(), system_category() ); -      result.second.capacity = result.second.free -        = result.second.available = 0; -    } -    return result; -  } - -  inline DWORD get_current_directory( DWORD sz, char * buf ) -    { return ::GetCurrentDirectoryA( sz, buf ); }  - -  template< class String > -  error_code -  get_current_path_template( String & ph ) -  { -    DWORD sz; -    if ( (sz = get_current_directory( 0, -      static_cast<typename String::value_type*>(0) )) == 0 ) -      { sz = 1; } -    typedef typename String::value_type value_type; -    boost::scoped_array<value_type> buf( new value_type[sz] ); -    if ( get_current_directory( sz, buf.get() ) == 0 ) -      return error_code( ::GetLastError(), system_category() ); -    ph = buf.get(); -    return ok; -  } - -  inline bool set_current_directory( const char * buf ) -    { return ::SetCurrentDirectoryA( buf ) != 0; }  - -  template< class String > -  error_code -  set_current_path_template( const String & ph ) -  { -    return error_code( set_current_directory( ph.c_str() ) -      ? 0 : ::GetLastError(), system_category() ); -  } - -  inline std::size_t get_full_path_name( -    const std::string & ph, std::size_t len, char * buf, char ** p ) -  { -    return static_cast<std::size_t>( -      ::GetFullPathNameA( ph.c_str(), -        static_cast<DWORD>(len), buf, p )); -  }  - -  const std::size_t buf_size( 128 ); - -  template<class String> -  error_code -  get_full_path_name_template( const String & ph, String & target ) -  { -    typename String::value_type buf[buf_size]; -    typename String::value_type * pfn; -    std::size_t len = get_full_path_name( ph, -      buf_size , buf, &pfn ); -    if ( len == 0 ) return error_code( ::GetLastError(), system_category() ); -    if ( len > buf_size ) -    { -      typedef typename String::value_type value_type; -      boost::scoped_array<value_type> big_buf( new value_type[len] ); -      if ( (len=get_full_path_name( ph, len , big_buf.get(), &pfn )) -        == 0 ) return error_code( ::GetLastError(), system_category() ); -      big_buf[len] = '\0'; -      target = big_buf.get(); -      return ok; -    } -    buf[len] = '\0'; -    target = buf; -    return ok; -  } - -  template<class String> -  error_code -  get_file_write_time( const String & ph, FILETIME & last_write_time ) -  { -    handle_wrapper hw( -      create_file( ph.c_str(), 0, -        FILE_SHARE_DELETE | FILE_SHARE_READ | FILE_SHARE_WRITE, 0, -        OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, 0 ) ); -    if ( hw.handle == INVALID_HANDLE_VALUE ) -      return error_code( ::GetLastError(), system_category() ); -    return error_code( ::GetFileTime( hw.handle, 0, 0, &last_write_time ) != 0 -      ? 0 : ::GetLastError(), system_category() ); -  } - -  template<class String> -  error_code -  set_file_write_time( const String & ph, const FILETIME & last_write_time ) -  { -    handle_wrapper hw( -      create_file( ph.c_str(), FILE_WRITE_ATTRIBUTES, -        FILE_SHARE_DELETE | FILE_SHARE_READ | FILE_SHARE_WRITE, 0, -        OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, 0 ) ); -    if ( hw.handle == INVALID_HANDLE_VALUE ) -      return error_code( ::GetLastError(), system_category() ); -    return error_code( ::SetFileTime( hw.handle, 0, 0, &last_write_time ) != 0 -      ? 0 : ::GetLastError(), system_category() ); -  } - -  // these constants come from inspecting some Microsoft sample code -  std::time_t to_time_t( const FILETIME & ft ) -  { -    __int64 t = (static_cast<__int64>( ft.dwHighDateTime ) << 32) -      + ft.dwLowDateTime; -# if !defined( BOOST_MSVC ) || BOOST_MSVC > 1300 // > VC++ 7.0 -    t -= 116444736000000000LL; -# else -    t -= 116444736000000000; -# endif -    t /= 10000000; -    return static_cast<std::time_t>( t ); -  } - -  void to_FILETIME( std::time_t t, FILETIME & ft ) -  { -    __int64 temp = t; -    temp *= 10000000; -# if !defined( BOOST_MSVC ) || BOOST_MSVC > 1300 // > VC++ 7.0 -    temp += 116444736000000000LL; -# else -    temp += 116444736000000000; -# endif -    ft.dwLowDateTime = static_cast<DWORD>( temp ); -    ft.dwHighDateTime = static_cast<DWORD>( temp >> 32 ); -  } - -  template<class String> -  boost::filesystem2::detail::time_pair -  last_write_time_template( const String & ph ) -  { -    FILETIME lwt; -    error_code ec( -      get_file_write_time( ph, lwt ) ); -    return std::make_pair( ec, to_time_t( lwt ) ); -  } - -  template<class String> -  error_code -  last_write_time_template( const String & ph, const std::time_t new_time ) -  { -    FILETIME lwt; -    to_FILETIME( new_time, lwt ); -    return set_file_write_time( ph, lwt ); -  } - -  bool remove_directory( const std::string & ph ) -    { return ::RemoveDirectoryA( ph.c_str() ) != 0; } -   -  bool delete_file( const std::string & ph ) -    { return ::DeleteFileA( ph.c_str() ) != 0; } -   -  template<class String> -  error_code -  remove_template( const String & ph ) -  { -    // TODO: test this code in the presence of Vista symlinks, -    // including dangling, self-referal, and cyclic symlinks -    error_code ec; -    fs::file_status sf( fs::detail::status_api( ph, ec ) ); -    if ( ec )  -      return ec; -    if ( sf.type() == fs::file_not_found ) -      return ok; -    if ( fs::is_directory( sf ) ) -    { -      if ( !remove_directory( ph ) ) -        return error_code(::GetLastError(), system_category()); -    } -    else -    { -      if ( !delete_file( ph ) ) return error_code(::GetLastError(), system_category()); -    } -    return ok; -  } - -  inline bool create_directory( const std::string & dir ) -    {  return ::CreateDirectoryA( dir.c_str(), 0 ) != 0; } -          -  template<class String> -  boost::filesystem2::detail::query_pair -  create_directory_template( const String & dir_ph ) -  { -    error_code error, dummy; -    if ( create_directory( dir_ph ) ) return std::make_pair( error, true ); -    error = error_code( ::GetLastError(), system_category() ); -    // an error here may simply mean the postcondition is already met -    if ( error.value() == ERROR_ALREADY_EXISTS -      && fs::is_directory( fs::detail::status_api( dir_ph, dummy ) ) ) -      return std::make_pair( ok, false ); -    return std::make_pair( error, false ); -  } - -#if _WIN32_WINNT >= 0x500 -  inline bool create_hard_link( const std::string & to_ph, -    const std::string & from_ph ) -    {  return ::CreateHardLinkA( from_ph.c_str(), to_ph.c_str(), 0 ) != 0; } -#endif -   -#if _WIN32_WINNT >= 0x500 -  template<class String> -  error_code -  create_hard_link_template( const String & to_ph, -    const String & from_ph ) -  { -    return error_code( create_hard_link( to_ph.c_str(), from_ph.c_str() ) -      ? 0 : ::GetLastError(), system_category() ); -  } -#endif - -#else // BOOST_POSIX_API - -  int posix_remove( const char * p ) -  { -#     if defined(__QNXNTO__) || (defined(__MSL__) && (defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__))) -        // Some Metrowerks C library versions fail on directories because of a -        // known Metrowerks coding error in ::remove. Workaround is to call -        // rmdir() or unlink() as indicated. -        // Same bug also reported for QNX, with the same fix. -        int err = ::unlink( p ); -        if ( err == 0 || errno != EPERM ) -          return err; -        return ::rmdir( p ); -#     else -        return std::remove( p ); -#     endif -  } - -#endif -} // unnamed namespace - -namespace boost -{ -  namespace filesystem2 -  { -    namespace detail -    { -      BOOST_FILESYSTEM_DECL system::error_code throws; - -//  free functions  ----------------------------------------------------------// - -      BOOST_FILESYSTEM_DECL error_code not_found_error() -      { -#     ifdef BOOST_WINDOWS_API -        return error_code(ERROR_PATH_NOT_FOUND, system_category()); -#     else -        return error_code(ENOENT, system_category());  -#     endif -      } - -      BOOST_FILESYSTEM_DECL bool possible_large_file_size_support() -      { -#   ifdef BOOST_POSIX_API -        struct stat lcl_stat; -        return sizeof( lcl_stat.st_size ) > 4; -#   else -        return true; -#   endif -      } - -#   ifdef BOOST_WINDOWS_API - -      BOOST_FILESYSTEM_DECL fs::file_status -        status_api( const std::string & ph, error_code & ec ) -        { return status_template( ph, ec ); } - -#     ifndef BOOST_FILESYSTEM2_NARROW_ONLY - -      BOOST_FILESYSTEM_DECL fs::file_status -      status_api( const std::wstring & ph, error_code & ec ) -        { return status_template( ph, ec ); } - -      BOOST_FILESYSTEM_DECL bool symbolic_link_exists_api( const std::wstring & ) -        { return false; } - -      BOOST_FILESYSTEM_DECL -      fs::detail::query_pair is_empty_api( const std::wstring & ph ) -        { return is_empty_template( ph ); } - -      BOOST_FILESYSTEM_DECL -      fs::detail::query_pair -      equivalent_api( const std::wstring & ph1, const std::wstring & ph2 ) -        { return equivalent_template( ph1, ph2 ); } - -      BOOST_FILESYSTEM_DECL -      fs::detail::uintmax_pair file_size_api( const std::wstring & ph ) -        { return file_size_template( ph ); } - -      BOOST_FILESYSTEM_DECL -      fs::detail::space_pair space_api( const std::wstring & ph ) -        { return space_template( ph ); } - -      BOOST_FILESYSTEM_DECL -      error_code  -      get_current_path_api( std::wstring & ph ) -        { return get_current_path_template( ph ); } - -      BOOST_FILESYSTEM_DECL -      error_code  -      set_current_path_api( const std::wstring & ph ) -        { return set_current_path_template( ph ); } - -      BOOST_FILESYSTEM_DECL error_code -        get_full_path_name_api( const std::wstring & ph, std::wstring & target ) -         { return get_full_path_name_template( ph, target ); } - -      BOOST_FILESYSTEM_DECL time_pair -        last_write_time_api( const std::wstring & ph ) -          { return last_write_time_template( ph ); } -  -      BOOST_FILESYSTEM_DECL error_code -        last_write_time_api( const std::wstring & ph, std::time_t new_value ) -          { return last_write_time_template( ph, new_value ); } - -      BOOST_FILESYSTEM_DECL fs::detail::query_pair -      create_directory_api( const std::wstring & ph ) -        { return create_directory_template( ph ); } - -#if _WIN32_WINNT >= 0x500 -      BOOST_FILESYSTEM_DECL error_code -      create_hard_link_api( const std::wstring & to_ph, -        const std::wstring & from_ph ) -        { return create_hard_link_template( to_ph, from_ph ); } -#endif -       -      BOOST_FILESYSTEM_DECL error_code -      create_symlink_api( const std::wstring & /*to_ph*/, -        const std::wstring & /*from_ph*/ ) -        { return error_code( ERROR_NOT_SUPPORTED, system_category() ); } - -      BOOST_FILESYSTEM_DECL error_code -      remove_api( const std::wstring & ph ) { return remove_template( ph ); } - -      BOOST_FILESYSTEM_DECL error_code -      rename_api( const std::wstring & from, const std::wstring & to ) -      { -        return error_code( ::MoveFileW( from.c_str(), to.c_str() ) -          ? 0 : ::GetLastError(), system_category() ); -      } - -      BOOST_FILESYSTEM_DECL error_code -      copy_file_api( const std::wstring & from, const std::wstring & to, bool fail_if_exists ) -      { -        return error_code( ::CopyFileW( from.c_str(), to.c_str(), fail_if_exists ) -          ? 0 : ::GetLastError(), system_category() ); -      } - -      BOOST_FILESYSTEM_DECL bool create_file_api( const std::wstring & ph, -        std::ios_base::openmode mode ) // true if succeeds -      { -        DWORD access( -          ((mode & std::ios_base::in) == 0 ? 0 : GENERIC_READ) -          | ((mode & std::ios_base::out) == 0 ? 0 : GENERIC_WRITE) ); - -        DWORD disposition(0); // see 27.8.1.3 Table 92 -        if ( (mode&~std::ios_base::binary) -          == (std::ios_base::out|std::ios_base::app) ) -          disposition = OPEN_ALWAYS; -        else if ( (mode&~(std::ios_base::binary|std::ios_base::out)) -          == std::ios_base::in ) disposition = OPEN_EXISTING; -        else if ( ((mode&~(std::ios_base::binary|std::ios_base::trunc)) -          == std::ios_base::out ) -          || ((mode&~std::ios_base::binary) -          == (std::ios_base::in|std::ios_base::out|std::ios_base::trunc)) ) -          disposition = CREATE_ALWAYS; -        else BOOST_ASSERT( 0 && "invalid mode argument" ); - -        HANDLE handle ( ::CreateFileW( ph.c_str(), access, -          FILE_SHARE_DELETE | FILE_SHARE_READ | FILE_SHARE_WRITE, 0, -          disposition, (mode &std::ios_base::out) != 0 -          ? FILE_ATTRIBUTE_ARCHIVE : FILE_ATTRIBUTE_NORMAL, 0 ) ); -        if ( handle == INVALID_HANDLE_VALUE ) return false; -        ::CloseHandle( handle ); -        return true; -      } - -      BOOST_FILESYSTEM_DECL std::string narrow_path_api( -        const std::wstring & ph ) // return is empty if fails -      { -        std::string narrow_short_form; -        std::wstring short_form; -        for ( DWORD buf_sz( static_cast<DWORD>( ph.size()+1 ));; ) -        { -          boost::scoped_array<wchar_t> buf( new wchar_t[buf_sz] ); -          DWORD sz( ::GetShortPathNameW( ph.c_str(), buf.get(), buf_sz ) ); -          if ( sz == 0 ) return narrow_short_form; -          if ( sz <= buf_sz ) -          { -            short_form += buf.get(); -            break; -          } -          buf_sz = sz + 1; -        } -        // contributed by Takeshi Mouri: -        int narrow_sz( ::WideCharToMultiByte( CP_ACP, 0, -          short_form.c_str(), static_cast<int>(short_form.size()), 0, 0, 0, 0 ) ); -        boost::scoped_array<char> narrow_buf( new char[narrow_sz] ); -        ::WideCharToMultiByte( CP_ACP, 0, -          short_form.c_str(), static_cast<int>(short_form.size()), -          narrow_buf.get(), narrow_sz, 0, 0 ); -        narrow_short_form.assign(narrow_buf.get(), narrow_sz); - -        return narrow_short_form; -      } - -      BOOST_FILESYSTEM_DECL error_code -      dir_itr_first( void *& handle, const std::wstring & dir, -        std::wstring & target, file_status & sf, file_status & symlink_sf ) -      { -        // use a form of search Sebastian Martel reports will work with Win98 -        std::wstring dirpath( dir ); -        dirpath += (dirpath.empty() -          || dirpath[dirpath.size()-1] != L'\\') ? L"\\*" : L"*"; - -        WIN32_FIND_DATAW data; -        if ( (handle = ::FindFirstFileW( dirpath.c_str(), &data )) -          == INVALID_HANDLE_VALUE ) -        {  -          handle = 0; -          return error_code( ::GetLastError() == ERROR_FILE_NOT_FOUND -            ? 0 : ::GetLastError(), system_category() ); -        } -        target = data.cFileName; -        if ( data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY ) -          { sf.type( directory_file ); symlink_sf.type( directory_file ); } -        else { sf.type( regular_file ); symlink_sf.type( regular_file ); } -        return ok; -      }   - -      BOOST_FILESYSTEM_DECL error_code -      dir_itr_increment( void *& handle, std::wstring & target, -        file_status & sf, file_status & symlink_sf ) -      { -        WIN32_FIND_DATAW data; -        if ( ::FindNextFileW( handle, &data ) == 0 ) // fails -        { -          int error = ::GetLastError(); -          dir_itr_close( handle ); -          return error_code( error == ERROR_NO_MORE_FILES ? 0 : error, system_category() ); -        } -        target = data.cFileName; -        if ( data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY ) -          { sf.type( directory_file ); symlink_sf.type( directory_file ); } -        else { sf.type( regular_file ); symlink_sf.type( regular_file ); } -        return ok; -      } - -#     endif // ifndef BOOST_FILESYSTEM2_NARROW_ONLY - -      // suggested by Walter Landry -      BOOST_FILESYSTEM_DECL bool symbolic_link_exists_api( const std::string & ) -        { return false; } - -      BOOST_FILESYSTEM_DECL -      fs::detail::query_pair is_empty_api( const std::string & ph ) -        { return is_empty_template( ph ); } - -      BOOST_FILESYSTEM_DECL -      fs::detail::query_pair -      equivalent_api( const std::string & ph1, const std::string & ph2 ) -        { return equivalent_template( ph1, ph2 ); } - -      BOOST_FILESYSTEM_DECL -      fs::detail::uintmax_pair file_size_api( const std::string & ph ) -        { return file_size_template( ph ); } - -      BOOST_FILESYSTEM_DECL -      fs::detail::space_pair space_api( const std::string & ph ) -        { return space_template( ph ); } - -      BOOST_FILESYSTEM_DECL -      error_code  -      get_current_path_api( std::string & ph ) -        { return get_current_path_template( ph ); } - -      BOOST_FILESYSTEM_DECL -      error_code  -      set_current_path_api( const std::string & ph ) -        { return set_current_path_template( ph ); } - -      BOOST_FILESYSTEM_DECL error_code -        get_full_path_name_api( const std::string & ph, std::string & target ) -         { return get_full_path_name_template( ph, target ); } - -      BOOST_FILESYSTEM_DECL time_pair -        last_write_time_api( const std::string & ph ) -          { return last_write_time_template( ph ); } -  -      BOOST_FILESYSTEM_DECL error_code -        last_write_time_api( const std::string & ph, std::time_t new_value ) -          { return last_write_time_template( ph, new_value ); } - -      BOOST_FILESYSTEM_DECL fs::detail::query_pair -      create_directory_api( const std::string & ph ) -        { return create_directory_template( ph ); } - -#if _WIN32_WINNT >= 0x500 -      BOOST_FILESYSTEM_DECL error_code -      create_hard_link_api( const std::string & to_ph, -        const std::string & from_ph ) -      {  -        return create_hard_link_template( to_ph, from_ph ); -      } -#endif - -      BOOST_FILESYSTEM_DECL error_code -      create_symlink_api( const std::string & /*to_ph*/, -        const std::string & /*from_ph*/ ) -        { return error_code( ERROR_NOT_SUPPORTED, system_category() ); } - -      BOOST_FILESYSTEM_DECL error_code -      remove_api( const std::string & ph ) { return remove_template( ph ); } - -      BOOST_FILESYSTEM_DECL error_code -      rename_api( const std::string & from, const std::string & to ) -      { -        return error_code( ::MoveFileA( from.c_str(), to.c_str() ) -          ? 0 : ::GetLastError(), system_category() ); -      } - -      BOOST_FILESYSTEM_DECL error_code -      copy_file_api( const std::string & from, const std::string & to, bool fail_if_exists ) -      { -        return error_code( ::CopyFileA( from.c_str(), to.c_str(), fail_if_exists ) -          ? 0 : ::GetLastError(), system_category() ); -      } - -      BOOST_FILESYSTEM_DECL error_code -      dir_itr_first( void *& handle, const std::string & dir, -        std::string & target, file_status & sf, file_status & symlink_sf ) -      // Note: an empty root directory has no "." or ".." entries, so this -      // causes a ERROR_FILE_NOT_FOUND error which we do not considered an -      // error. It is treated as eof instead. -      { -        // use a form of search Sebastian Martel reports will work with Win98 -        std::string dirpath( dir ); -        dirpath += (dirpath.empty() -          || (dirpath[dirpath.size()-1] != '\\' -            && dirpath[dirpath.size()-1] != ':')) ? "\\*" : "*"; - -        WIN32_FIND_DATAA data; -        if ( (handle = ::FindFirstFileA( dirpath.c_str(), &data )) -          == INVALID_HANDLE_VALUE ) -        {  -          handle = 0; -          return error_code( (::GetLastError() == ERROR_FILE_NOT_FOUND -                           // Windows Mobile returns ERROR_NO_MORE_FILES; see ticket #3551                                            -                           || ::GetLastError() == ERROR_NO_MORE_FILES)  -            ? 0 : ::GetLastError(), system_category() ); -        } -        target = data.cFileName; -        if ( data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY ) -          { sf.type( directory_file ); symlink_sf.type( directory_file ); } -        else { sf.type( regular_file ); symlink_sf.type( regular_file ); } -        return ok; -      } - -      BOOST_FILESYSTEM_DECL error_code -      dir_itr_close( void *& handle ) -      { -        if ( handle != 0 ) -        { -          bool ok = ::FindClose( handle ) != 0; -          handle = 0; -          return error_code( ok ? 0 : ::GetLastError(), system_category() ); -        } -        return ok; -      } - -      BOOST_FILESYSTEM_DECL error_code -      dir_itr_increment( void *& handle, std::string & target, -        file_status & sf, file_status & symlink_sf ) -      { -        WIN32_FIND_DATAA data; -        if ( ::FindNextFileA( handle, &data ) == 0 ) // fails -        { -          int error = ::GetLastError(); -          dir_itr_close( handle ); -          return error_code( error == ERROR_NO_MORE_FILES ? 0 : error, system_category() ); -        } -        target = data.cFileName; -        if ( data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY ) -          { sf.type( directory_file ); symlink_sf.type( directory_file ); } -        else { sf.type( regular_file ); symlink_sf.type( regular_file ); } -        return ok; -      } - -#   else // BOOST_POSIX_API - -      BOOST_FILESYSTEM_DECL fs::file_status -      status_api( const std::string & ph, error_code & ec ) -      { -        struct stat path_stat; -        if ( ::stat( ph.c_str(), &path_stat ) != 0 ) -        { -          if ( errno == ENOENT || errno == ENOTDIR ) -          { -            ec = ok; -            return fs::file_status( fs::file_not_found ); -          } -          ec = error_code( errno, system_category() ); -          return fs::file_status( fs::status_unknown ); -        } -        ec = ok; -        if ( S_ISDIR( path_stat.st_mode ) ) -          return fs::file_status( fs::directory_file ); -        if ( S_ISREG( path_stat.st_mode ) ) -          return fs::file_status( fs::regular_file ); -        if ( S_ISBLK( path_stat.st_mode ) ) -          return fs::file_status( fs::block_file ); -        if ( S_ISCHR( path_stat.st_mode ) ) -          return fs::file_status( fs::character_file ); -        if ( S_ISFIFO( path_stat.st_mode ) ) -          return fs::file_status( fs::fifo_file ); -        if ( S_ISSOCK( path_stat.st_mode ) ) -          return fs::file_status( fs::socket_file ); -        return fs::file_status( fs::type_unknown ); -      } - -      BOOST_FILESYSTEM_DECL fs::file_status -      symlink_status_api( const std::string & ph, error_code & ec ) -      { -        struct stat path_stat; -        if ( ::lstat( ph.c_str(), &path_stat ) != 0 ) -        { -          if ( errno == ENOENT || errno == ENOTDIR ) -          { -            ec = ok; -            return fs::file_status( fs::file_not_found ); -          } -          ec = error_code( errno, system_category() ); -          return fs::file_status( fs::status_unknown ); -        } -        ec = ok; -        if ( S_ISREG( path_stat.st_mode ) ) -          return fs::file_status( fs::regular_file ); -        if ( S_ISDIR( path_stat.st_mode ) ) -          return fs::file_status( fs::directory_file ); -        if ( S_ISLNK( path_stat.st_mode ) ) -          return fs::file_status( fs::symlink_file ); -        if ( S_ISBLK( path_stat.st_mode ) ) -          return fs::file_status( fs::block_file ); -        if ( S_ISCHR( path_stat.st_mode ) ) -          return fs::file_status( fs::character_file ); -        if ( S_ISFIFO( path_stat.st_mode ) ) -          return fs::file_status( fs::fifo_file ); -        if ( S_ISSOCK( path_stat.st_mode ) ) -          return fs::file_status( fs::socket_file ); -        return fs::file_status( fs::type_unknown ); -      } - -      // suggested by Walter Landry -      BOOST_FILESYSTEM_DECL bool -      symbolic_link_exists_api( const std::string & ph ) -      { -        struct stat path_stat; -        return ::lstat( ph.c_str(), &path_stat ) == 0 -          && S_ISLNK( path_stat.st_mode ); -      } - -      BOOST_FILESYSTEM_DECL query_pair -      is_empty_api( const std::string & ph ) -      { -        struct stat path_stat; -        if ( (::stat( ph.c_str(), &path_stat )) != 0 ) -          return std::make_pair( error_code( errno, system_category() ), false );         -        return std::make_pair( ok, S_ISDIR( path_stat.st_mode ) -          ? is_empty_directory( ph ) -          : path_stat.st_size == 0 ); -      } - -      BOOST_FILESYSTEM_DECL query_pair -      equivalent_api( const std::string & ph1, const std::string & ph2 ) -      { -        struct stat s2; -        int e2( ::stat( ph2.c_str(), &s2 ) ); -        struct stat s1; -        int e1( ::stat( ph1.c_str(), &s1 ) ); -        if ( e1 != 0 || e2 != 0 ) -          return std::make_pair( error_code( e1 != 0 && e2 != 0 ? errno : 0, system_category() ), false ); -        // at this point, both stats are known to be valid -        return std::make_pair( ok, -            s1.st_dev == s2.st_dev -            && s1.st_ino == s2.st_ino -            // According to the POSIX stat specs, "The st_ino and st_dev fields -            // taken together uniquely identify the file within the system." -            // Just to be sure, size and mod time are also checked. -            && s1.st_size == s2.st_size -            && s1.st_mtime == s2.st_mtime ); -      } -  -      BOOST_FILESYSTEM_DECL uintmax_pair -      file_size_api( const std::string & ph ) -      { -        struct stat path_stat; -        if ( ::stat( ph.c_str(), &path_stat ) != 0 ) -          return std::make_pair( error_code( errno, system_category() ), 0 ); -        if ( !S_ISREG( path_stat.st_mode ) ) -          return std::make_pair( error_code( EPERM, system_category() ), 0 );  -        return std::make_pair( ok, -          static_cast<boost::uintmax_t>(path_stat.st_size) ); -      } - -      BOOST_FILESYSTEM_DECL space_pair -      space_api( const std::string & ph ) -      { -        struct BOOST_STATVFS vfs; -        space_pair result; -        if ( ::BOOST_STATVFS( ph.c_str(), &vfs ) != 0 ) -        { -          result.first = error_code( errno, system_category() ); -          result.second.capacity = result.second.free -            = result.second.available = 0; -        } -        else -        { -          result.first = ok; -          result.second.capacity  -            = static_cast<boost::uintmax_t>(vfs.f_blocks) * BOOST_STATVFS_F_FRSIZE; -          result.second.free  -            = static_cast<boost::uintmax_t>(vfs.f_bfree) * BOOST_STATVFS_F_FRSIZE; -          result.second.available -            = static_cast<boost::uintmax_t>(vfs.f_bavail) * BOOST_STATVFS_F_FRSIZE; -        } -        return result; -      } - -      BOOST_FILESYSTEM_DECL time_pair  -      last_write_time_api( const std::string & ph ) -      { -        struct stat path_stat; -        if ( ::stat( ph.c_str(), &path_stat ) != 0 ) -          return std::make_pair( error_code( errno, system_category() ), 0 ); -        return std::make_pair( ok, path_stat.st_mtime ); -      } - -      BOOST_FILESYSTEM_DECL error_code -      last_write_time_api( const std::string & ph, std::time_t new_value ) -      { -        struct stat path_stat; -        if ( ::stat( ph.c_str(), &path_stat ) != 0 ) -          return error_code( errno, system_category() ); -        ::utimbuf buf; -        buf.actime = path_stat.st_atime; // utime() updates access time too:-( -        buf.modtime = new_value; -        return error_code( ::utime( ph.c_str(), &buf ) != 0 ? errno : 0, system_category() ); -      } - -      BOOST_FILESYSTEM_DECL error_code  -      get_current_path_api( std::string & ph ) -      { -        for ( long path_max = 32;; path_max *=2 ) // loop 'til buffer large enough -        { -          boost::scoped_array<char> -            buf( new char[static_cast<std::size_t>(path_max)] ); -          if ( ::getcwd( buf.get(), static_cast<std::size_t>(path_max) ) == 0 ) -          { -            if ( errno != ERANGE -          // bug in some versions of the Metrowerks C lib on the Mac: wrong errno set  -#         if defined(__MSL__) && (defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__)) -              && errno != 0 -#         endif -              ) return error_code( errno, system_category() ); -          } -          else -          { -            ph = buf.get(); -            break; -          } -        } -        return ok; -      } - -      BOOST_FILESYSTEM_DECL error_code -      set_current_path_api( const std::string & ph ) -      { -        return error_code( ::chdir( ph.c_str() ) -          ? errno : 0, system_category() ); -      } - -      BOOST_FILESYSTEM_DECL fs::detail::query_pair -      create_directory_api( const std::string & ph ) -      { -        if ( ::mkdir( ph.c_str(), S_IRWXU|S_IRWXG|S_IRWXO ) == 0 ) -          { return std::make_pair( ok, true ); } -        int ec=errno; -        error_code dummy; -        if ( ec != EEXIST  -          || !fs::is_directory( status_api( ph, dummy ) ) ) -          { return std::make_pair( error_code( ec, system_category() ), false ); } -        return std::make_pair( ok, false ); -      } - -      BOOST_FILESYSTEM_DECL error_code -      create_hard_link_api( const std::string & to_ph, -          const std::string & from_ph ) -      { -        return error_code( ::link( to_ph.c_str(), from_ph.c_str() ) == 0 -          ? 0 : errno, system_category() ); -      } - -      BOOST_FILESYSTEM_DECL error_code -      create_symlink_api( const std::string & to_ph, -          const std::string & from_ph ) -      { -        return error_code( ::symlink( to_ph.c_str(), from_ph.c_str() ) == 0 -          ? 0 : errno, system_category() );  -      } - -      BOOST_FILESYSTEM_DECL error_code -      remove_api( const std::string & ph ) -      { -        if ( posix_remove( ph.c_str() ) == 0 ) -          return ok; -        int error = errno; -        // POSIX says "If the directory is not an empty directory, rmdir() -        // shall fail and set errno to EEXIST or ENOTEMPTY." -        // Linux uses ENOTEMPTY, Solaris uses EEXIST. -        if ( error == EEXIST ) error = ENOTEMPTY; - -        error_code ec; - -        // ignore errors if post-condition satisfied -        return status_api(ph, ec).type() == file_not_found -          ? ok : error_code( error, system_category() ) ; -      } - -      BOOST_FILESYSTEM_DECL error_code -      rename_api( const std::string & from, const std::string & to ) -      { -        // POSIX is too permissive so must check -        error_code dummy; -        if ( fs::exists( status_api( to, dummy ) ) )  -          return error_code( EEXIST, system_category() ); -        return error_code( std::rename( from.c_str(), to.c_str() ) != 0  -          ? errno : 0, system_category() ); -      } - -      BOOST_FILESYSTEM_DECL error_code -      copy_file_api( const std::string & from_file_ph, -        const std::string & to_file_ph, bool fail_if_exists ) -      { -        const std::size_t buf_sz = 32768; -        boost::scoped_array<char> buf( new char [buf_sz] ); -        int infile=-1, outfile=-1;  // -1 means not open - -        // bug fixed: code previously did a stat() on the from_file first, but that -        // introduced a gratuitous race condition; the stat() is now done after the open() - -        if ( (infile = ::open( from_file_ph.c_str(), O_RDONLY )) < 0 ) -          { return error_code( errno, system_category() ); } - -        struct stat from_stat; -        if ( ::stat( from_file_ph.c_str(), &from_stat ) != 0 ) -          { return error_code( errno, system_category() ); } - -        int oflag = O_CREAT | O_WRONLY | O_TRUNC; -        if ( fail_if_exists ) -          oflag |= O_EXCL; -        if (  (outfile = ::open( to_file_ph.c_str(), oflag, from_stat.st_mode )) < 0 ) -        { -          int open_errno = errno; -          BOOST_ASSERT( infile >= 0 ); -          ::close( infile ); -          return error_code( open_errno, system_category() ); -        } - -        ssize_t sz, sz_read=1, sz_write; -        while ( sz_read > 0 -          && (sz_read = ::read( infile, buf.get(), buf_sz )) > 0 ) -        { -          // Allow for partial writes - see Advanced Unix Programming (2nd Ed.), -          // Marc Rochkind, Addison-Wesley, 2004, page 94 -          sz_write = 0; -          do -          { -            if ( (sz = ::write( outfile, buf.get() + sz_write, -              sz_read - sz_write )) < 0 ) -            {  -              sz_read = sz; // cause read loop termination -              break;        //  and error to be thrown after closes -            } -            sz_write += sz; -          } while ( sz_write < sz_read ); -        } - -        if ( ::close( infile) < 0 ) sz_read = -1; -        if ( ::close( outfile) < 0 ) sz_read = -1; - -        return error_code( sz_read < 0 ? errno : 0, system_category() ); -      } - -      // this code is based on Stevens and Rago, Advanced Programming in the -      // UNIX envirnment, 2nd Ed., ISBN 0-201-43307-9, page 49 -      error_code path_max( std::size_t & result ) -      { -#     ifdef PATH_MAX -        static std::size_t max = PATH_MAX; -#     else -        static std::size_t max = 0; -#     endif -        if ( max == 0 ) -        { -          errno = 0; -          long tmp = ::pathconf( "/", _PC_NAME_MAX ); -          if ( tmp < 0 ) -          { -            if ( errno == 0 ) // indeterminate -              max = 4096; // guess -            else return error_code( errno, system_category() ); -          } -          else max = static_cast<std::size_t>( tmp + 1 ); // relative root -        } -        result = max; -        return ok; -      } - -      BOOST_FILESYSTEM_DECL error_code -      dir_itr_first( void *& handle, void *& buffer, -        const std::string & dir, std::string & target, -        file_status &, file_status & ) -      { -        if ( (handle = ::opendir( dir.c_str() )) == 0 ) -          return error_code( errno, system_category() ); -        target = std::string( "." ); // string was static but caused trouble -                                     // when iteration called from dtor, after -                                     // static had already been destroyed -        std::size_t path_size (0);  // initialization quiets gcc warning -        error_code ec = path_max( path_size ); -        if ( ec ) return ec; -        dirent de; -        buffer = std::malloc( (sizeof(dirent) - sizeof(de.d_name)) -          +  path_size + 1 ); // + 1 for "/0" -        return ok; -      }   - -      BOOST_FILESYSTEM_DECL error_code -      dir_itr_close( void *& handle, void*& buffer ) -      { -        std::free( buffer ); -        buffer = 0; -        if ( handle == 0 ) return ok; -        DIR * h( static_cast<DIR*>(handle) ); -        handle = 0; -        return error_code( ::closedir( h ) == 0 ? 0 : errno, system_category() ); -      } - -      // warning: the only dirent member updated is d_name -      inline int readdir_r_simulator( DIR * dirp, struct dirent * entry, -        struct dirent ** result ) // *result set to 0 on end of directory -        { -          errno = 0; - -    #     if !defined(__CYGWIN__) \ -          && defined(_POSIX_THREAD_SAFE_FUNCTIONS) \ -          && defined(_SC_THREAD_SAFE_FUNCTIONS) \ -          && (_POSIX_THREAD_SAFE_FUNCTIONS+0 >= 0) \ -          && (!defined(__hpux) || defined(_REENTRANT)) \ -          && (!defined(_AIX) || defined(__THREAD_SAFE)) -          if ( ::sysconf( _SC_THREAD_SAFE_FUNCTIONS ) >= 0 ) -            { return ::readdir_r( dirp, entry, result ); } -    #     endif - -          struct dirent * p; -          *result = 0; -          if ( (p = ::readdir( dirp )) == 0 ) -            return errno; -          std::strcpy( entry->d_name, p->d_name ); -          *result = entry; -          return 0; -        } - -      BOOST_FILESYSTEM_DECL error_code -      dir_itr_increment( void *& handle, void *& buffer, -        std::string & target, file_status & sf, file_status & symlink_sf ) -      { -        BOOST_ASSERT( buffer != 0 ); -        dirent * entry( static_cast<dirent *>(buffer) ); -        dirent * result; -        int return_code; -        if ( (return_code = readdir_r_simulator( static_cast<DIR*>(handle), -          entry, &result )) != 0 ) return error_code( errno, system_category() ); -        if ( result == 0 ) return dir_itr_close( handle, buffer ); -        target = entry->d_name; -#     ifdef BOOST_FILESYSTEM_STATUS_CACHE -        if ( entry->d_type == DT_UNKNOWN )  // filesystem does not supply d_type value -        { -          sf = symlink_sf = fs::file_status(fs::status_unknown); -        } -        else  // filesystem supplies d_type value -        { -          if ( entry->d_type == DT_DIR ) -            sf = symlink_sf = fs::file_status( fs::directory_file ); -          else if ( entry->d_type == DT_REG ) -            sf = symlink_sf = fs::file_status( fs::regular_file ); -          else if ( entry->d_type == DT_LNK ) -          { -            sf = fs::file_status( fs::status_unknown ); -            symlink_sf = fs::file_status( fs::symlink_file ); -          } -          else sf = symlink_sf = fs::file_status( fs::status_unknown ); -        } -#     else -        sf = symlink_sf = fs::file_status( fs::status_unknown ); -#     endif -        return ok; -      } - -#   endif -    } // namespace detail -  } // namespace filesystem2 -} // namespace boost diff --git a/3rdParty/Boost/src/libs/filesystem/v2/src/v2_path.cpp b/3rdParty/Boost/src/libs/filesystem/v2/src/v2_path.cpp deleted file mode 100644 index 16f6583..0000000 --- a/3rdParty/Boost/src/libs/filesystem/v2/src/v2_path.cpp +++ /dev/null @@ -1,177 +0,0 @@ -//  path.cpp  ----------------------------------------------------------------// - -//  Copyright 2005 Beman Dawes - -//  Distributed under the Boost Software License, Version 1.0. (See accompanying -//  file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) - -//  See library home page at http://www.boost.org/libs/filesystem - -//----------------------------------------------------------------------------//  - -// define BOOST_FILESYSTEM_SOURCE so that <boost/filesystem/config.hpp> knows -// the library is being built (possibly exporting rather than importing code) -#define BOOST_FILESYSTEM_SOURCE  - -#ifndef BOOST_SYSTEM_NO_DEPRECATED  -# define BOOST_SYSTEM_NO_DEPRECATED -#endif - -#include <boost/filesystem/v2/config.hpp> - -#ifndef BOOST_FILESYSTEM2_NARROW_ONLY - -#include <boost/filesystem/v2/path.hpp> -#include <boost/scoped_array.hpp> - -#include <locale> -#include <boost/cerrno.hpp> -#include <boost/system/error_code.hpp> - -#include <cwchar>     // for std::mbstate_t - -#if defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__)  -# include <boost/filesystem/detail/utf8_codecvt_facet.hpp> -#endif - - -namespace -{ -  // std::locale construction can throw (if LC_MESSAGES is wrong, for example), -  // so a static at function scope is used to ensure that exceptions can be -  // caught. (A previous version was at namespace scope, so initialization -  // occurred before main(), preventing exceptions from being caught.) -  std::locale & loc() -  { -#if !defined(macintosh) && !defined(__APPLE__) && !defined(__APPLE_CC__)  -    // ISO C calls this "the locale-specific native environment": -    static std::locale lc(""); -#else  // Mac OS -    // "All BSD system functions expect their string parameters to be in UTF-8 encoding -    // and nothing else." -    // See http://developer.apple.com/mac/library/documentation/MacOSX/Conceptual/BPInternational/Articles/FileEncodings.html -    std::locale global_loc = std::locale();  // Mac OS doesn't support locale("") -    static std::locale lc(global_loc, -        new boost::filesystem::detail::utf8_codecvt_facet);   -#endif -    return lc; -  } - -  const std::codecvt<wchar_t, char, std::mbstate_t> *& -  converter() -  { -   static const std::codecvt<wchar_t, char, std::mbstate_t> * -     cvtr( -       &std::use_facet<std::codecvt<wchar_t, char, std::mbstate_t> > -        ( loc() ) ); -   return cvtr; -  } - -  bool locked(false); -} // unnamed namespace - -namespace boost -{ -  namespace filesystem2 -  { -    bool wpath_traits::imbue( const std::locale & new_loc, const std::nothrow_t & ) -    { -      if ( locked ) return false; -      locked = true; -      loc() = new_loc; -      converter() = &std::use_facet -        <std::codecvt<wchar_t, char, std::mbstate_t> >( loc() ); -      return true; -    } - -    void wpath_traits::imbue( const std::locale & new_loc ) -    { -      if ( locked ) BOOST_FILESYSTEM_THROW( -        wfilesystem_error( -          "boost::filesystem::wpath_traits::imbue() after lockdown", -          make_error_code( system::errc::not_supported ) ) ); -      imbue( new_loc, std::nothrow ); -    } - -    //namespace detail -    //{ -    //  BOOST_FILESYSTEM_DECL -    //  const char * what( const char * sys_err_what, -    //    const path & path1, const path & path2, std::string & target) -    //  { -    //    try -    //    { -    //      if ( target.empty() ) -    //      { -    //        target = sys_err_what; -    //        if ( !path1.empty() ) -    //        { -    //          target += ": \""; -    //          target += path1.file_string(); -    //          target += "\""; -    //        } -    //        if ( !path2.empty() ) -    //        { -    //          target += ", \""; -    //          target += path2.file_string(); -    //          target += "\""; -    //        } -    //      } -    //      return target.c_str(); -    //    } -    //    catch (...) -    //    { -    //      return sys_err_what; -    //    } -    //  } -    //} -     -# ifdef BOOST_POSIX_API - -//  Because this is POSIX only code, we don't have to worry about ABI issues -//  described in http://www.boost.org/more/separate_compilation.html - -    wpath_traits::external_string_type -    wpath_traits::to_external( const wpath & ph,  -      const internal_string_type & src ) -    { -      locked = true; -      std::size_t work_size( converter()->max_length() * (src.size()+1) ); -      boost::scoped_array<char> work( new char[ work_size ] ); -      std::mbstate_t state = std::mbstate_t();  // perhaps unneeded, but cuts bug reports -      const internal_string_type::value_type * from_next; -      external_string_type::value_type * to_next; -      if ( converter()->out(  -        state, src.c_str(), src.c_str()+src.size(), from_next, work.get(), -        work.get()+work_size, to_next ) != std::codecvt_base::ok ) -        BOOST_FILESYSTEM_THROW( boost::filesystem::wfilesystem_error( -          "boost::filesystem::wpath::to_external conversion error", -          ph, system::error_code( system::errc::invalid_argument, system::system_category() ) ) ); -      *to_next = '\0'; -      return external_string_type( work.get() ); -    } - -    wpath_traits::internal_string_type -    wpath_traits::to_internal( const external_string_type & src ) -    { -      locked = true; -      std::size_t work_size( src.size()+1 ); -      boost::scoped_array<wchar_t> work( new wchar_t[ work_size ] ); -      std::mbstate_t state  = std::mbstate_t();  // perhaps unneeded, but cuts bug reports -      const external_string_type::value_type * from_next; -      internal_string_type::value_type * to_next; -      if ( converter()->in(  -        state, src.c_str(), src.c_str()+src.size(), from_next, work.get(), -        work.get()+work_size, to_next ) != std::codecvt_base::ok ) -        BOOST_FILESYSTEM_THROW( boost::filesystem::wfilesystem_error( -          "boost::filesystem::wpath::to_internal conversion error", -          system::error_code( system::errc::invalid_argument, system::system_category() ) ) ); -      *to_next = L'\0'; -      return internal_string_type( work.get() ); -    } -# endif // BOOST_POSIX_API - -  } // namespace filesystem2 -} // namespace boost - -#endif // ifndef BOOST_FILESYSTEM2_NARROW_ONLY diff --git a/3rdParty/Boost/src/libs/filesystem/v2/src/v2_portability.cpp b/3rdParty/Boost/src/libs/filesystem/v2/src/v2_portability.cpp deleted file mode 100644 index 4d27543..0000000 --- a/3rdParty/Boost/src/libs/filesystem/v2/src/v2_portability.cpp +++ /dev/null @@ -1,119 +0,0 @@ -//  portability.cpp  ---------------------------------------------------------// - -//  Copyright 2002-2005 Beman Dawes -//  Use, modification, and distribution is subject to the Boost Software -//  License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy -//  at http://www.boost.org/LICENSE_1_0.txt) - -//  See library home page at http://www.boost.org/libs/filesystem - -//----------------------------------------------------------------------------//  - -// define BOOST_FILESYSTEM_SOURCE so that <boost/filesystem/config.hpp> knows -// the library is being built (possibly exporting rather than importing code) -#define BOOST_FILESYSTEM_SOURCE  - -#ifndef BOOST_SYSTEM_NO_DEPRECATED  -# define BOOST_SYSTEM_NO_DEPRECATED -#endif - -#include <boost/filesystem/v2/config.hpp> -#include <boost/filesystem/v2/path.hpp> - -namespace fs = boost::filesystem2; - -#include <cstring> // SGI MIPSpro compilers need this - -# ifdef BOOST_NO_STDC_NAMESPACE -    namespace std { using ::strerror; } -# endif - -//----------------------------------------------------------------------------// - -namespace -{ -  const char invalid_chars[] = -    "\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0A\x0B\x0C\x0D\x0E\x0F" -    "\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1A\x1B\x1C\x1D\x1E\x1F" -    "<>:\"/\\|"; -  // note that the terminating '\0' is part of the string - thus the size below -  // is sizeof(invalid_chars) rather than sizeof(invalid_chars)-1.  I  -  const std::string windows_invalid_chars( invalid_chars, sizeof(invalid_chars) ); - -  const std::string valid_posix( -    "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789._-" ); - -} // unnamed namespace - -namespace boost -{ -  namespace filesystem2 -  { - -    //  name_check functions  ----------------------------------------------// - -#   ifdef BOOST_WINDOWS -    BOOST_FILESYSTEM_DECL bool native( const std::string & name ) -    { -      return windows_name( name ); -    } -#   else -    BOOST_FILESYSTEM_DECL bool native( const std::string & name ) -    { -      return  name.size() != 0 -        && name[0] != ' ' -        && name.find('/') == std::string::npos; -    } -#   endif - -    BOOST_FILESYSTEM_DECL bool portable_posix_name( const std::string & name ) -    { -      return name.size() != 0 -        && name.find_first_not_of( valid_posix ) == std::string::npos;      -    } - -    BOOST_FILESYSTEM_DECL bool windows_name( const std::string & name ) -    { -      return name.size() != 0 -        && name[0] != ' ' -        && name.find_first_of( windows_invalid_chars ) == std::string::npos -        && *(name.end()-1) != ' ' -        && (*(name.end()-1) != '.' -          || name.length() == 1 || name == ".."); -    } - -    BOOST_FILESYSTEM_DECL bool portable_name( const std::string & name ) -    { -      return -        name.size() != 0 -        && ( name == "." -          || name == ".." -          || (windows_name( name ) -            && portable_posix_name( name ) -            && name[0] != '.' && name[0] != '-')); -    } - -    BOOST_FILESYSTEM_DECL bool portable_directory_name( const std::string & name ) -    { -      return -        name == "." -        || name == ".." -        || (portable_name( name ) -          && name.find('.') == std::string::npos); -    } - -    BOOST_FILESYSTEM_DECL bool portable_file_name( const std::string & name ) -    { -      std::string::size_type pos; -      return -         portable_name( name ) -         && name != "." -         && name != ".." -         && ( (pos = name.find( '.' )) == std::string::npos -             || (name.find( '.', pos+1 ) == std::string::npos -               && (pos + 5) > name.length() )) -        ; -    } - -  } // namespace filesystem2 -} // namespace boost  | 
 Swift