Go to the documentation of this file.
25 #ifndef _FILESYSTEM_HPP_
26 #define _FILESYSTEM_HPP_
28 #ifdef __cplusplus_cli
30 #define generic __identifier(generic)
36 #include <boost/filesystem/operations.hpp>
37 #include <boost/filesystem/convenience.hpp>
38 #include <boost/filesystem/fstream.hpp>
39 #include <boost/version.hpp>
42 namespace bfs = boost::filesystem;
44 #ifndef BOOST_FILESYSTEM_VERSION
45 # if (BOOST_VERSION/100) >= 1046
46 # define BOOST_FILESYSTEM_VERSION 3
48 # define BOOST_FILESYSTEM_VERSION 2
50 #endif // BOOST_FILESYSTEM_VERSION
56 #if BOOST_FILESYSTEM_VERSION == 2
58 #define BFS_STRING(p) p
59 #define BFS_GENERIC_STRING(p) p
61 #define BFS_COMPLETE bfs::complete
64 #define BFS_STRING(p) (p).string()
65 #define BFS_GENERIC_STRING(p) (p).generic_string()
67 #define BFS_COMPLETE bfs::system_complete
82 vector<bfs::path>& matchingPaths);
88 PWIZ_API_DECL void copy_directory(
const bfs::path& from,
const bfs::path& to,
bool recursive =
true, boost::system::error_code* ec = 0);
123 #endif // _FILESYSTEM_HPP_
PWIZ_API_DECL std::pair< int, int > get_console_bounds(const std::pair< int, int > &defaultBounds=std::pair< int, int >(80, 24))
attempts to get the platform-specific console bounds (number of columns and lines),...
PWIZ_API_DECL void force_close_handles_to_filepath(const std::string &filepath, bool closeMemoryMappedSections=false) noexcept(true)
on Windows, closes all file handles and memory mapped sections relating to the given filepath
@ ByteSizeAbbreviation_SI
sizes are treated as multiples of 10; abbreviations are: GB (Gigabyte), MB (Megabyte),...
@ ByteSizeAbbreviation_IEC
sizes are treated as multiples of 2; abbreviations are: GiB (Gibibyte), MiB (Mebibyte),...
PWIZ_API_DECL bool isHTTP(const std::string &filepath)
@ ByteSizeAbbreviation_JEDEC
sizes are treated as multiples of 2; abbreviations are: GB (Gigabyte), MB (Megabyte),...
PWIZ_API_DECL int expand_pathmask(const bfs::path &pathmask, vector< bfs::path > &matchingPaths)
expands (aka globs) a pathmask to zero or more matching paths and returns the number of matching path...
PWIZ_API_DECL void copy_directory(const bfs::path &from, const bfs::path &to, bool recursive=true, boost::system::error_code *ec=0)
if recursive is true, then copies "from" and all its contents to "to"; if "to" already exists or the ...
PWIZ_API_DECL std::string read_file_header(const std::string &filepath, size_t length=512)
PWIZ_API_DECL std::string abbreviate_byte_size(boost::uintmax_t byteSize, ByteSizeAbbreviation abbreviationType=ByteSizeAbbreviation_SI)
abbreviates a byte size (file or RAM) as a readable string, using the specified notation