66 lines
1.3 KiB
C++
66 lines
1.3 KiB
C++
#ifndef HXDISK_H
|
|
#define HXDISK_H
|
|
|
|
#include "HxTrace.h"
|
|
|
|
#include <QStorageInfo>
|
|
#include <QtGlobal>
|
|
|
|
class HxDisk
|
|
{
|
|
public:
|
|
/**
|
|
* @brief 创建文件夹
|
|
* @param path 路径
|
|
*/
|
|
static void mkpath(QString path);
|
|
|
|
|
|
static void mkpath(QStringList names);
|
|
|
|
/**
|
|
* @brief 判断盘符是否存在
|
|
* @param rootPath 路径
|
|
* @return
|
|
*/
|
|
static bool exist(QString rootPath);
|
|
|
|
|
|
static bool empty(QString path);
|
|
|
|
/**
|
|
* @brief 遍历盘符信息
|
|
* @return 返回磁盘信息
|
|
*/
|
|
static QList<QStorageInfo> mounted_volumes();
|
|
|
|
/**
|
|
* @brief 获取磁盘总空间大小
|
|
* @param rootPath 路径
|
|
* @return 总空间, 单位: G
|
|
*/
|
|
static double total_size(QString rootPath);
|
|
|
|
/**
|
|
* @brief 获取磁盘剩余空间大小
|
|
* @param rootPath 路径
|
|
* @return 剩余空间, 单位: G
|
|
*/
|
|
static double free_size(QString rootPath);
|
|
|
|
/**
|
|
* @brief 检索目录信息总数
|
|
* @param path 目录路径
|
|
* @return 文件总数
|
|
*/
|
|
static int entry_info_list(QString path);
|
|
|
|
/**
|
|
* @brief 删除文件并判断目录是否为空, 为空时删除目录
|
|
* @param filepath 文件路径
|
|
*/
|
|
static void remove(QString filepath);
|
|
};
|
|
|
|
#endif
|