dl
命名空间 | 函数
dl_file.h 文件参考

文件系统 更多...

#include <string>
#include <vector>
#include <fstream>
#include "memory/dl_buffer.h"

浏览源代码.

命名空间

namespace  dl
 
namespace  dl::File
 

函数

void dl::File::GetPathFileAll (std::string_view path, std::vector< std::string > &ret, std::string_view regex="", bool recursion=true)
 遍历文件夹所有文件 更多...
 
FILE * dl::File::GetFile (std::string_view path_name, bool is_binary=true)
 打开一个文件(只读),可能从压缩包内读取 更多...
 
std::ifstream dl::File::Get (std::string_view path_name, bool is_binary=true)
 
bool dl::File::ConvertMb2U8 (std::string_view path_name, std::string_view out)
 将文本文件从mb转到utf-8 更多...
 
Buffer dl::File::GetBuffer (std::string_view path_name)
 返回文件内存 更多...
 
Buffer dl::File::GetBuffer (std::ifstream &ifs)
 返回文件内存 更多...
 
bool dl::File::SaveBuffer (const Buffer &buf, std::string_view path_name)
 将内存保存为文件 更多...
 
uint32_t dl::File::GetCrc32 (std::string_view path_name)
 ‍** 更多...
 
bool dl::File::IsExist (std::string_view path_name)
 返回文件是否存在 更多...
 
bool dl::File::Delete (std::string_view path_name, bool all=false)
 删除文件或路径 更多...
 
void dl::File::DeleteContent (std::string_view path_name)
 删除文件夹内容,但不删除文件夹 更多...
 
bool dl::File::Copy (std::string_view source, std::string_view target)
 复制文件 更多...
 
std::string dl::File::GetExtension (std::string_view path_name, bool has_dot=false)
 返回文件后缀 更多...
 
std::string dl::File::GetFilename (std::string_view path_name)
 返回文件名 更多...
 
std::string dl::File::GetStem (std::string_view path_name)
 返回文件名不含后缀 更多...
 
bool dl::File::CreateDirectory (std::string_view path)
 创建目录 更多...
 
time_t dl::File::GetLastWriteTime (std::string_view path_name)
 返回文件最后修改时间 更多...
 
bool dl::File::CheckPathFileModified (std::string_view path_name, std::string_view cache, bool update)
 判断路径内的文件是否有修改(包括增加、删除文件) 更多...
 
std::string dl::File::GetPathCurrent ()
 返回工作目录 更多...
 
std::string dl::File::GetPathTemp ()
 返回临时目录 更多...
 

详细描述

文件系统

版本
1.0
作者
lveyou
日期
21-08-09
注解
封装简化一些操作系统的文件操作。
原则0:使用/表示路径
原则1:路径的结尾规定带有/,因为cd到盘根路径必须加/,还因为相对路径不以/开头
原则2:优先使用相对路径,相对路径开头不带有/
原则3:/表示根路径、./表示当前目录、../表示上一目录
优先使用C++文件流,为了兼容再以C文件操作实现。
构造path后基于wstring字符串
由于std::filesystem的字符编码,为了便于使用,所以封装一层

在文件 dl_file.h 中定义.