# endif
# endif
+#if defined (BOOST_WINDOWS)
+# define WIN32_LEAN_AND_MEAN
+# include <windows.h>
+#endif
+
namespace fs = boost::filesystem;
namespace boost {
#ifdef BOOST_POSIX
return ::access(ph.string().c_str(), R_OK) == 0;
#endif
+#ifdef BOOST_WINDOWS
+ DWORD const attr = ::GetFileAttributes(ph.string().c_str());
+ return attr != INVALID_FILE_ATTRIBUTES &&
+ (attr & FILE_ATTRIBUTE_DIRECTORY) != FILE_ATTRIBUTE_DIRECTORY;
+#endif
}
#ifdef BOOST_POSIX
return ::access(ph.string().c_str(), W_OK) == 0;
#endif
+#ifdef BOOST_WINDOWS
+ DWORD const attr = ::GetFileAttributes(ph.string().c_str());
+ if (attr != INVALID_FILE_ATTRIBUTES &&
+ (attr & FILE_ATTRIBUTE_READONLY) != 0) {
+ // Read-only - no write access
+ return false;
+ }
+ return attr != INVALID_FILE_ATTRIBUTES &&
+ (attr & FILE_ATTRIBUTE_DIRECTORY) != FILE_ATTRIBUTE_DIRECTORY;
+#endif
}
#ifdef BOOST_POSIX
return is_readable(ph) && !is_writable(ph);
#endif
+#ifdef BOOST_WINDOWS
+ DWORD const attr = ::GetFileAttributes(ph.string().c_str());
+ return (attr != INVALID_FILE_ATTRIBUTES
+ && (attr & FILE_ATTRIBUTE_READONLY));
+#endif
}
source, target,
fs::detail::system_error_code()));
#endif
+#ifdef BOOST_WINDOWS
+ if (::CopyFile(source.string().c_str(), target.string().c_str(), !noclobber) == 0) {
+ boost::throw_exception(
+ filesystem_error(
+ "boost::filesystem::copy_file",
+ source, target,
+ fs::detail::system_error_code()));
+ }
+#endif
}
-
}
}