forked from iwxyi/EasyMeeting_Desktop
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfileutil.h
37 lines (30 loc) · 1.25 KB
/
fileutil.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#ifndef FILEUTIL_H
#define FILEUTIL_H
#include <QString>
#include <QFile>
#include <QMessageBox>
#include <QTextStream>
#include <QTextCodec>
#include <QFileInfo>
#include <QDir>
#include <QStandardPaths>
#include <QDebug>
QString readTextFile(QString path, QTextCodec* codec = QTextCodec::codecForName("utf-8"));
QString readTextFile(QString path, QString codec);
QString readExistedTextFile(QString path); // 文件不存在则创建
bool writeTextFile(QString path, QString text, QTextCodec* codec = QTextCodec::codecForName("utf-8"));
bool writeTextFile(QString path, QString text, QString codec);
bool copyFile(QString old_path, QString newPath); // 复制文件
bool copyFile2(QString old_path, QString new_path); // 复制文件(覆盖)
bool deleteFile(QString path);
bool renameFile(QString path, QString new_path/*完整路径*/);
bool isFileExist(QString path);
bool isDir(QString path);
bool ensureFileExist(QString path);
bool ensureDirExist(QString path);
bool ensureFileNotExist(QString path);
bool canBeFileName(QString name);
QString getPathWithIndex(QString dir, QString name, QString suffix);
QString getDirByFile(QString file_path);
void addLinkToDeskTop(const QString& filename,const QString& name); // 生成桌面快捷方式
#endif // FILEUTIL_H