// operations.cpp --------------------------------------------------------------------//
// Copyright 2002-2009 Beman Dawes
// Copyright 2001 Dietmar Kuehl
// Distributed under the Boost Software License, Version 1.0.
// See http://www.boost.org/LICENSE_1_0.txt
// See library home page at http://www.boost.org/libs/filesystem
//--------------------------------------------------------------------------------------//
// 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)
#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.
#else
#define _FILE_OFFSET_BITS 64
#endif
// 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 <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::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;
using std::string;
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
# 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"
# 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)
# define _WIN32_WINNT 0x0500
# endif
# if defined(__BORLANDC__) || defined(__MWERKS__)
# if defined(__BORLANDC__)
using std::time_t;
# endif
# include <utime.h>
# else
# include <sys/utime.h>
# endif
// REPARSE_DATA_BUFFER related definitions are found in ntifs.h, which is part of the
// Windows Device Driver Kit. Since that's inconvenient, the definitions are provided
// here. See http://msdn.microsoft.com/en-us/library/ms791514.aspx
#if !defined(REPARSE_DATA_BUFFER_HEADER_SIZE) // mingw winnt.h does provide the defs
#define SYMLINK_FLAG_RELATIVE 1
typedef struct _REPARSE_DATA_BUFFER {
ULONG ReparseTag;
USHORT ReparseDataLength;
USHORT Reserved;
union {
struct {
USHORT SubstituteNameOffset;
USHORT SubstituteNameLength;
USHORT PrintNameOffset;
USHORT PrintNameLength;
ULONG Flags;
WCHAR PathBuffer[1];
/* Example of distinction between substitute and print names:
mklink /d ldrive c:\
SubstituteName: c:\\??\
PrintName: c:\
*/
} SymbolicLinkReparseBuffer;
struct {
USHORT SubstituteNameOffset;
USHORT SubstituteNameLength;
USHORT PrintNameOffset;
USHORT PrintNameLength;
WCHAR PathBuffer[1];
} MountPointReparseBuffer;
struct {
UCHAR DataBuffer[1];
} GenericReparseBuffer;
};
} REPARSE_DATA_BUFFER, *PREPARSE_DATA_BUFFER;
#define REPARSE_DATA_BUFFER_HEADER_SIZE \
FIELD_OFFSET(REPARSE_DATA_BUFFER, GenericReparseBuffer)
#endif
#ifndef MAXIMUM_REPARSE_DATA_BUFFER_SIZE
#define MAXIMUM_REPARSE_DATA_BUFFER_SIZE ( 16 * 1024 )
#endif
# ifndef FSCTL_GET_REPARSE_POINT
# define FSCTL_GET_REPARSE_POINT 0x900a8
# endif
# ifndef IO_REPARSE_TAG_SYMLINK
# define IO_REPARSE_TAG_SYMLINK (0xA000000CL)
# endif
# endif // BOOST_WINDOWS_API
// 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
# define BOOST_FILESYSTEM_STATUS_CACHE
# endif
// POSIX/Windows macros ----------------------------------------------------//
// Portions of the POSIX and Windows API's are very similar, except for name,
// order of arguments, and meaning of zero/non-zero returns. The macros below
// abstract away those differences. They follow Windows naming and order of
// arguments, and return true to indicate no error occurred. [POSIX naming,
// order of arguments, and meaning of return were followed initially, but
// found to be less clear and cause more coding errors.]
# if defined(BOOST_POSIX_API)
// POSIX uses a 0 return to indicate success
# define BOOST_ERRNO errno
# define BOOST_SET_CURRENT_DIRECTORY(P)(::chdir(P)== 0)
# define BOOST_CREATE_DIRECTORY(P)(::mkdir(P, S_IRWXU|S_IRWXG|S_IRWXO)== 0)
# define BOOST_CREATE_HARD_LINK(F,T)(::link(T, F)== 0)
# define BOOST_CREATE_SYMBOLIC_LINK(F,T,Flag)(::symlink(T, F)== 0)
# define BOOST_REMOVE_DIRECTORY(P)(::rmdir(P)== 0)
# define BOOST_DELETE_FILE(P)(::unlink(P)== 0)
# define BOOST_COPY_DIRECTORY(F,T)(!(::stat(from.c_str(), &from_stat)!= 0\
|| ::mkdir(to.c_str(),from_stat.st_mode)!= 0))
# define BOOST_COPY_FILE(F,T,FailIfExistsBool)copy_file_api(F, T, FailIfExistsBool)
# define BOOST_MOVE_FILE(OLD,NEW)(::rename(OLD, NEW)== 0)
# define BOOST_RESIZE_FILE(P,SZ)(::truncate(P, SZ)== 0)
# define BOOST_ERROR_NOT_SUPPORTED ENOSYS
# define BOOST_ERROR_ALREADY_EXISTS EEXIST
# else // BOOST_WINDOWS_API
// Windows uses a non-0 return to indicate success
# define BOOST_ERRNO ::GetLastError()
# define BOOST_SET_CURRENT_DIRECTORY(P)(::SetCurrentDirectoryW(P)!= 0)
# define BOOST_CREATE_DIRECTORY(P)(::CreateDirectoryW(P, 0)!= 0)
# define BOOST_CREATE_HARD_LINK(F,T)(create_hard_link_api(F, T, 0)!= 0)
# define BOOST_CREATE_SYMBOLIC_LINK(F,T,Flag)(create_symbolic_link_api(F, T, Flag)!= 0)
# define BOOST_REMOVE_DIRECTORY(P)(::RemoveDirectoryW(P)!= 0)
# 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_
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
开放华为UC的eSpace状态控件,与UC设备强绑定 (2000个子文件)
dlldata.c 815B
dlldatax.c 459B
operations.cpp 69KB
documentation.cpp 34KB
regex_traits_defaults.cpp 29KB
path.cpp 28KB
class.cpp 27KB
function.cpp 25KB
cmdline.cpp 24KB
thread.cpp 24KB
StatusCtrl.cpp 23KB
thread.cpp 22KB
options_description.cpp 22KB
fileiter.cpp 21KB
icu.cpp 21KB
file_descriptor.cpp 20KB
error_code.cpp 19KB
w32_regex_traits.cpp 19KB
basic_iarchive.cpp 17KB
builtin_converters.cpp 17KB
cregex.cpp 16KB
mapped_file.cpp 15KB
inheritance.cpp 14KB
basic_oarchive.cpp 14KB
value_semantic.cpp 14KB
function_doc_signature.cpp 11KB
wc_regex_traits.cpp 11KB
str.cpp 11KB
void_cast.cpp 10KB
PluginWindowWin.cpp 10KB
PluginWindowX11.cpp 10KB
clone_current_exception_non_intrusive.cpp 9KB
from_python.cpp 9KB
communicator.cpp 9KB
tss_pe.cpp 9KB
registry.cpp 9KB
variables_map.cpp 8KB
enum.cpp 8KB
parsers.cpp 8KB
path_traits.cpp 8KB
wide_posix_api.cpp 7KB
PluginEventMacCarbon.cpp 7KB
numeric.cpp 7KB
posix_api.cpp 7KB
py_nonblocking.cpp 7KB
signal_base.cpp 7KB
type_id.cpp 6KB
sp_collector.cpp 6KB
PluginWindowlessWin.cpp 6KB
KeyCodesX11.cpp 6KB
NpapiPluginWin.cpp 6KB
zlib.cpp 6KB
xml_wgrammar.cpp 6KB
c_regex_traits.cpp 6KB
config_file.cpp 6KB
skeleton_and_content.cpp 6KB
greg_month.cpp 6KB
object_protocol.cpp 6KB
KeyCodesCarbon.cpp 6KB
KeyCodesCocoa.cpp 6KB
log4cplus.cpp 5KB
bzip2.cpp 5KB
regex.cpp 5KB
convert.cpp 5KB
random_device.cpp 5KB
extended_type_info.cpp 5KB
sp_debug_hooks.cpp 5KB
PluginWindowMacCG.cpp 5KB
life_support.cpp 5KB
gzip.cpp 5KB
broadcast.cpp 4KB
py_communicator.cpp 4KB
FireBreathWin.cpp 4KB
extended_type_info_typeid.cpp 4KB
request.cpp 4KB
collectives.cpp 4KB
NpapiPluginX11.cpp 4KB
dict.cpp 4KB
shared_ptr_helper.cpp 4KB
connection.cpp 4KB
winmain.cpp 4KB
list.cpp 4KB
exec.cpp 4KB
static_mutex.cpp 4KB
portability.cpp 4KB
point_to_point.cpp 4KB
object_operators.cpp 3KB
basic_serializer_map.cpp 3KB
PluginEventMac.cpp 3KB
named_slot_map.cpp 3KB
unique_path.cpp 3KB
py_environment.cpp 3KB
usinstances.cpp 3KB
cpp_regex_traits.cpp 3KB
archive_exception.cpp 3KB
environment.cpp 3KB
group.cpp 3KB
slot.cpp 3KB
extended_type_info_no_rtti.cpp 3KB
basic_archive.cpp 3KB
共 2000 条
- 1
- 2
- 3
- 4
- 5
- 6
- 20
资源评论
Java程序员-张凯
- 粉丝: 1w+
- 资源: 6651
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功