-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathXFileManagement.cpp
More file actions
35 lines (28 loc) · 849 Bytes
/
Copy pathXFileManagement.cpp
File metadata and controls
35 lines (28 loc) · 849 Bytes
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
#include "XFileManagement.h"
std::unique_ptr<XFileManagement> m_file(new XFileManagement);
XFileManagement::XFileManagement(){}
XFileManagement::~XFileManagement() {}
void XFileManagement::initializing()
{
if(!QDir().exists(APP_NAME))
QDir().mkdir(app_diractory(APP_NAME));
if(QFile::exists(app_data("Log.txt")))
QFile::remove(app_data("Log.txt"));
}
void XFileManagement::set_directory(QString app_dir) {
m_app_dir = app_dir;
m_app_dir.replace('/', "//");
}
QString XFileManagement::app_diractory(QString m_dir) {
if(m_dir.isNull())
return m_app_dir;
else
return QString("%1//%2").arg(m_app_dir).arg(m_dir);
}
QString XFileManagement::app_data(QString filename)
{
if(filename.isNull())
return QString("%1//%2").arg(m_app_dir).arg(APP_NAME);
else
return QString("%1//%2//%3").arg(m_app_dir).arg(APP_NAME).arg(filename);
}