|
dl
|
函数 | |
| void | GetPathFileAll (std::string_view path, std::vector< std::string > &ret, std::string_view regex="", bool recursion=true) |
| 遍历文件夹所有文件 更多... | |
| FILE * | GetFile (std::string_view path_name, bool is_binary=true) |
| 打开一个文件(只读),可能从压缩包内读取 更多... | |
| std::ifstream | Get (std::string_view path_name, bool is_binary=true) |
| bool | ConvertMb2U8 (std::string_view path_name, std::string_view out) |
| 将文本文件从mb转到utf-8 更多... | |
| Buffer | GetBuffer (std::string_view path_name) |
| 返回文件内存 更多... | |
| Buffer | GetBuffer (std::ifstream &ifs) |
| 返回文件内存 更多... | |
| bool | SaveBuffer (const Buffer &buf, std::string_view path_name) |
| 将内存保存为文件 更多... | |
| uint32_t | GetCrc32 (std::string_view path_name) |
| ** 更多... | |
| bool | IsExist (std::string_view path_name) |
| 返回文件是否存在 更多... | |
| bool | Delete (std::string_view path_name, bool all=false) |
| 删除文件或路径 更多... | |
| void | DeleteContent (std::string_view path_name) |
| 删除文件夹内容,但不删除文件夹 更多... | |
| bool | Copy (std::string_view source, std::string_view target) |
| 复制文件 更多... | |
| std::string | GetExtension (std::string_view path_name, bool has_dot=false) |
| 返回文件后缀 更多... | |
| std::string | GetFilename (std::string_view path_name) |
| 返回文件名 更多... | |
| std::string | GetStem (std::string_view path_name) |
| 返回文件名不含后缀 更多... | |
| bool | CreateDirectory (std::string_view path) |
| 创建目录 更多... | |
| time_t | GetLastWriteTime (std::string_view path_name) |
| 返回文件最后修改时间 更多... | |
| bool | CheckPathFileModified (std::string_view path_name, std::string_view cache, bool update) |
| 判断路径内的文件是否有修改(包括增加、删除文件) 更多... | |
| std::string | GetPathCurrent () |
| 返回工作目录 更多... | |
| std::string | GetPathTemp () |
| 返回临时目录 更多... | |
| bool dl::File::CheckPathFileModified | ( | std::string_view | path_name, |
| std::string_view | cache, | ||
| bool | update | ||
| ) |
判断路径内的文件是否有修改(包括增加、删除文件)
| [in] | path_name | 路径名称 |
| [in] | cache | 用于生成和保存的文件信息的文件 |
| [in] | update | cache文件如果存在且不匹配,是否更新cache |
| bool dl::File::ConvertMb2U8 | ( | std::string_view | path_name, |
| std::string_view | out | ||
| ) |
将文本文件从mb转到utf-8
| [in] | path_name | 路径名称 |
| [in] | out | 输出文件的路径名称 |
| 如果失败,会输出日志 |
| bool dl::File::Copy | ( | std::string_view | source, |
| std::string_view | target | ||
| ) |
复制文件
| [in] | source | 源文件 |
| [in] | target | 目标文件 |
| bool dl::File::CreateDirectory | ( | std::string_view | path | ) |
创建目录
| [in] | path | 路径 |
| bool dl::File::Delete | ( | std::string_view | path_name, |
| bool | all = false |
||
| ) |
删除文件或路径
| [in] | path_name | 路径名称 |
| [in] | all | 为真时可以删除非空文件夹 |
| 删除失败返回假 |
| void dl::File::DeleteContent | ( | std::string_view | path_name | ) |
删除文件夹内容,但不删除文件夹
| [in] | path_name | 路径名称 |
| std::ifstream dl::File::Get | ( | std::string_view | path_name, |
| bool | is_binary = true |
||
| ) |
| Buffer dl::File::GetBuffer | ( | std::ifstream & | ifs | ) |
返回文件内存
| [in] | ifs | 文件句柄 |
| 需要手动释放内存 |
| Buffer dl::File::GetBuffer | ( | std::string_view | path_name | ) |
返回文件内存
| [in] | path_name | 路径名称 |
| 需要手动释放内存 |
| uint32_t dl::File::GetCrc32 | ( | std::string_view | path_name | ) |
**
**
返回文件crc32值
| [in] | path_name | 路径名称 |
| 0代表失败 |
| std::string dl::File::GetExtension | ( | std::string_view | path_name, |
| bool | has_dot = false |
||
| ) |
返回文件后缀
| [in] | path_name | |
| [in] | has_dot | 是否含有“.”,比如.txt而不是txt |
| FILE * dl::File::GetFile | ( | std::string_view | path_name, |
| bool | is_binary = true |
||
| ) |
打开一个文件(只读),可能从压缩包内读取
| [in] | path_name | 路径名称 |
| [in] | binary | 是否以二进制模式打开 |
| 文件句柄 |
| std::string dl::File::GetFilename | ( | std::string_view | path_name | ) |
返回文件名
| [in] | path_name |
| time_t dl::File::GetLastWriteTime | ( | std::string_view | path_name | ) |
返回文件最后修改时间
| [in] | path_name | 路径名称 |
| std::string dl::File::GetPathCurrent | ( | ) |
返回工作目录
| void dl::File::GetPathFileAll | ( | std::string_view | path, |
| std::vector< std::string > & | ret, | ||
| std::string_view | regex = "", |
||
| bool | recursion = true |
||
| ) |
遍历文件夹所有文件
| [in] | path | 路径 |
| [out] | ret | 返回的文件名 |
| [in] | regex | 正则表达式,例如 .(png|jpg)$ |
| [in] | recursion | 递归文件夹 |
| std::string dl::File::GetPathTemp | ( | ) |
返回临时目录
| std::string dl::File::GetStem | ( | std::string_view | path_name | ) |
返回文件名不含后缀
| [in] | path_name |
| bool dl::File::IsExist | ( | std::string_view | path_name | ) |
返回文件是否存在
| [in] | path_name | 路径名称 |
| bool dl::File::SaveBuffer | ( | const Buffer & | buf, |
| std::string_view | path_name | ||
| ) |
将内存保存为文件
| [in] | buf | 内存 |
| [in] | path_name | 保存路径(文件夹必须存在) |