2014-08-21 07:58:11 +00:00
|
|
|
#include "FileSystem.h"
|
|
|
|
|
|
|
|
#include <QDir>
|
2014-08-21 10:36:28 +00:00
|
|
|
#include <QFileInfo>
|
2015-11-18 21:22:09 +00:00
|
|
|
#include <cstdio>
|
2014-08-21 07:58:11 +00:00
|
|
|
|
2015-12-10 23:36:50 +00:00
|
|
|
string FileSystem::getTempFile(const string &filename) {
|
2014-08-21 07:58:11 +00:00
|
|
|
return QDir::temp().filePath(QString::fromStdString(filename)).toStdString();
|
|
|
|
}
|
2014-08-21 10:36:28 +00:00
|
|
|
|
2015-12-10 23:36:50 +00:00
|
|
|
bool FileSystem::isFile(const string &filepath) {
|
2014-08-21 10:36:28 +00:00
|
|
|
return QFileInfo(QString::fromStdString(filepath)).exists();
|
|
|
|
}
|
2015-11-18 21:22:09 +00:00
|
|
|
|
2015-12-10 23:36:50 +00:00
|
|
|
bool FileSystem::removeFile(const string &filepath) {
|
2015-11-18 21:22:09 +00:00
|
|
|
if (FileSystem::isFile(filepath)) {
|
|
|
|
remove(filepath.c_str());
|
2015-11-20 00:07:31 +00:00
|
|
|
return true;
|
|
|
|
} else {
|
|
|
|
return false;
|
2015-11-18 21:22:09 +00:00
|
|
|
}
|
|
|
|
}
|