Files
RCiRoot e3f7733316 V20260829-2.6.1
完成框架目录和模块重构;新增核心、单例、工具、加密及框架 SDK;统一任务、相机和 RPC 接口,并增加离线检测、相机标定、备份恢复、版本管理、崩溃守护和心跳监控功能。
2026-09-20 16:01:09 +08:00

64 lines
2.4 KiB
C++

#pragma once
#include<qstring.h>
#include <vector>
#include <string>
#include <qdir.h>
#include <io.h>
#include <qdatetime.h>
#include <qstorageinfo.h>
#include <qdebug.h>
#include <iostream>
#include <filesystem>
#include <eui_tools/export.h>
class fileManager
{
public:
/// <summary>
/// 获取所有文件夹
/// </summary>
/// <param name="folderPath"></param>
/// <param name="folderNames"></param>
static std::vector<std::string> getAllDirs(const QString& folderPath);
/// <summary>
/// 获取文件夹下格式的文件,以vector<string>返回
/// </summary>
/// <param name="path"></param>
/// <param name="files"></param>
/// <param name="format"></param>
static void getAllFiles(std::string path, std::vector<std::string>& files, std::string format, int targetDepth = INT_MAX, int depth = 0);
/// <summary>
/// 获取文件夹下的图片,以vector<string>返回
/// </summary>
/// <param name="path"></param>
/// <param name="files"></param>
/// <param name="format"></param>
static void getAllImages(std::string path, std::vector<std::string>& files, std::string format, int targetDepth = INT_MAX, int depth = 0);
/// <summary>
/// 检查磁盘剩余空间,以GB为单位返回
/// </summary>
/// <param name="folderPath">example"E://""E://111/222"支持文件夹或者磁盘路径</param>
/// <returns></returns>
static int getDriveFreeSpaceAsGb(const QString& folderPath);
/// <summary>
/// 检查磁盘剩余空间,以Mb为单位返回
/// </summary>
/// <param name="folderPath">example"E://""E://111/222"支持文件夹或者磁盘路径</param>
/// <returns></returns>
static int getDriveFreeSpaceAsMb(const QString& folderPath);
//去除重复分割符
static QString normalizePathSeparators(const QString& path);
static bool isImageFile(const std::string& filename);
static std::string getFileName(std::string path);
static QString getFileName(const QString& path);
//统一地址分隔符
static QString normalizePathStr(const QString& address, QChar targetSeparator = '/');
//统一地址分隔符
static std::string normalizePathStr(const std::string& address, char targetSeparator = '/');
static void createDirectoryIfNotExists(const std::string& path);
static EUI_TOOLS_API bool setFileReadOnly(const std::string& filePath, bool readOnly);
};