|
Core Library
1.7.0.0
Library containing core utilities and tools for threading, networking, logging, INI and CSV file management etc.
|
The file_utils namespace. More...
Enumerations | |
| enum | eCopyDirectoryOptions { eCopyDirectoryOptions::failIfTargetExists, eCopyDirectoryOptions::continueIfTargetExists } |
| Copy directory options enumeration. More... | |
Functions | |
| bool CORE_LIBRARY_DLL_SHARED_API | FindFileRecursively (const std::wstring &dirPath, const std::wstring &fileName, std::wstring &pathFound, bool includeFileName=true) |
| Find the common root path of 2 paths. More... | |
| std::wstring CORE_LIBRARY_DLL_SHARED_API | FindCommonRootPath (const std::wstring &path1, const std::wstring &path2) |
| Find the common root path of 2 paths. More... | |
| void CORE_LIBRARY_DLL_SHARED_API | CopyDirectoryRecursively (const std::wstring &source, const std::wstring &target, eCopyDirectoryOptions options=eCopyDirectoryOptions::continueIfTargetExists) |
| Recursively copy one directory and its contents to another location. More... | |
| std::list< std::wstring > CORE_LIBRARY_DLL_SHARED_API | ListDirectoryContents (const std::wstring &path, const std::wstring &extMatch=L"") |
| List of regular files in the specified directory. More... | |
| std::list< std::wstring > CORE_LIBRARY_DLL_SHARED_API | ListSubDirectories (const std::wstring &path) |
| List of immediate sub-directories in the specified directory. More... | |
The file_utils namespace.
|
strong |
| void core_lib::file_utils::CopyDirectoryRecursively | ( | const std::wstring & | source, |
| const std::wstring & | target, | ||
| eCopyDirectoryOptions | options = eCopyDirectoryOptions::continueIfTargetExists |
||
| ) |
Recursively copy one directory and its contents to another location.
| [in] | source | - Source path from where we will copy data. |
| [in] | target | - Target path to where we will place the copied data. |
| [in] | options | - Control how to handle exsiting target locations. |
Based on an example given in Learning Boost C++ Libraries by Arindam Mukherjee.
Preconditions that are enforced by this function are:
Throws std::runtime_error if an error occurs. If target folder already exists then the source is copied into a folder within the target folder with the same name as the srouce folder.
| std::wstring core_lib::file_utils::FindCommonRootPath | ( | const std::wstring & | path1, |
| const std::wstring & | path2 | ||
| ) |
Find the common root path of 2 paths.
| [in] | path1 | - First path. |
| [in] | path2 | - Second path. |
Based on an example given in Learning Boost C++ Libraries by Arindam Mukherjee.
| bool core_lib::file_utils::FindFileRecursively | ( | const std::wstring & | dirPath, |
| const std::wstring & | fileName, | ||
| std::wstring & | pathFound, | ||
| bool | includeFileName = true |
||
| ) |
Find the common root path of 2 paths.
| [in] | dirPath | - Directory to search recusively. |
| [in] | fileName | - Name of file to search for. |
| [out] | pathFound | - Full path to the file. |
| [in] | includeFileName | - Flag to indicate if pathFound should include name of file. |
| std::list< std::wstring > core_lib::file_utils::ListDirectoryContents | ( | const std::wstring & | path, |
| const std::wstring & | extMatch = L"" |
||
| ) |
List of regular files in the specified directory.
| [in] | path | - Directory path. |
| [in] | extMatch | - (Optional) If specified then should be the file extension to filter by. |
Throws boost::filesystem_error if a problem occurs.
| std::list< std::wstring > core_lib::file_utils::ListSubDirectories | ( | const std::wstring & | path | ) |
List of immediate sub-directories in the specified directory.
| [in] | path | - Directory path. |
Throws boost::filesystem_error if a problem occurs.