169 bool recursive =
false);
The file guard class to manage the FILE pointer automatically. file_guard object can close the FILE p...
Definition fileutil.h:35
file_guard(FILE *file)
Construct a new file guard object.
FILE * getfd() const
Get the FILE pointer.
~file_guard()
Destroy the file guard object.
The class for file path operations.
Definition filepath.h:34
The class for file path operations.
Define the structs about fileutil, such as filetype and file_entity.
std::vector< file_entity > filevec
The vector of file_entity.
Definition filetype.h:75
filetype
The type of file.
Definition filetype.h:38
bool copyfile(const filepath &srcpath, const filepath &dstpath, bool attributes=false)
Copy a file or symbolic link(shortcut on windows).
bool createlink(const filepath &referenece, const filepath &filepath)
Create a symbolic link or shortcut.
filevec find_files(const filepath &dirpath, const std::string &name, bool recursive=false)
Find all files in a directory by name.
bool createfile(const filepath &path)
Create a new file.
std::string readtext(const filepath &path, uint64_t max_read_size=4096)
Read the text content of a file.
bool removedir(const filepath &path, bool recursive=false)
Remove a directory.
filevec find_files_by_extension(const filepath &dirpath, const std::string &extension, bool recursive=false)
Find all files in a directory by extension.
std::string filetype_flag(filetype type)
Get the file type flag string.
bool removefile(const filepath &path)
Remove a regular file or symbolic link(shortcut on windows).
filevec list_files(const filepath &dirpath, filetype type=filetype::ft_all, bool recursive=false)
List all files in a directory.
bool createdir(const filepath &path, bool recursive=false)
Create a new directory.
uint64_t dirsize(const filepath &dirpath)
Get the size of a directory, include all files and subdirectories.
uint64_t filesize(const filepath &filepath, bool link_target=false)
Get the size of a file.
bool copydir(const filepath &srcdir, const filepath &dstdir)
Copy a directory recursively.
bool writetext(const filepath &path, const std::string &content)
Write the text content to a file.