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-11-09 21:30:46 +00:00
|
|
|
std::string FileSystem::getTempFile(const std::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-11-09 21:30:46 +00:00
|
|
|
bool FileSystem::isFile(const std::string &filepath) {
|
2014-08-21 10:36:28 +00:00
|
|
|
return QFileInfo(QString::fromStdString(filepath)).exists();
|
|
|
|
}
|
2015-11-18 21:22:09 +00:00
|
|
|
|
|
|
|
bool FileSystem::removeFile(const std::string &filepath) {
|
|
|
|
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
|
|
|
}
|
|
|
|
}
|