15 #ifndef _A_UTILS_UTIL_FILESYSTEM_FILESYSTEM_INCLUDED_
16 #define _A_UTILS_UTIL_FILESYSTEM_FILESYSTEM_INCLUDED_
25 namespace filesystem {
111 std::vector<Path>& vec_entries,
File/Directory path class.
Error readTextLines(const Path &file_path, std::vector< std::string > &vec_lines)
Read entire content of a text file and split it every new line, dropping the EOL characters.
Error writeTextFile(const Path &file_path, const std::string &content)
Open a file in mode 'w' and write new content to it.
Error
Enumerates possible error values for filesystem interaction.
@ IO_ERROR
Input/output error during filesystem access.
@ OK
No error, basically meaning success.
@ INVALID_PATH
Accessed path on the filesystem is invalid.
@ OPEN_FAILED
Opening a file or folder from the filesystem failed.
@ ACCESS_DENIED
Access to file or folder in the filesystem denied.
@ GENERAL_FAILURE
General errors.
bool rename(const Path &path, const Path &new_path)
Rename or move a file or directory from path to new_path.
EnumDirFlags
Enumeration for possible listings in a directory, usable in function enumDirectory()
@ ED_FILES
List files in the directory.
@ ED_DIRECTORIES
List directories in the directory.
Error enumDirectory(const Path &dir_path, std::vector< Path > &vec_entries, std::int32_t flags=ED_FILES|ED_DIRECTORIES)
List all entries in a directory.
bool remove(const Path &path)
Remove the file or directory pointed to by path.
bool createDirectory(const Path &path)
Create a new directory on the filesystem.
std::int64_t compareFiles(const Path &p1, const Path &p2)
Compare content of two files.
bool isFile(const Path &file_path)
Check whether the path points to a file on the filesystem.
Error readTextFile(const Path &file_path, std::string &content)
Read entire content of a text file into a string.
Path getTempDirectory()
Retrieve path to the temp directory of the system.
bool isDirectory(const Path &dir_path)
Check whether the path points to a directory on the filesystem.
Error setWorkingDirectory(const Path &path)
Set the working directory.
DiffOptions
Available options for operations comparing files or directories.
@ none
Default behavior; needs to be specified by the using function.
bool exists(const Path &path)
Check whether the file or directory exists on the filesystem.
Path getWorkingDirectory()
Retrieve path to the working directory of the current process.
Serves as the root component, with common functionality documented in core functionality.
Public API for Path type and functions.