mirror of
https://github.com/wownero/wowlet.git
synced 2026-10-24 02:28:33 +02:00
Beta-6
This commit is contained in:
@@ -21,6 +21,24 @@
|
||||
QVector<logMessage> applicationLog = QVector<logMessage>(); // todo: replace with ring buffer
|
||||
QMutex logMutex;
|
||||
|
||||
QByteArray Utils::fileGetContents(const QString &path)
|
||||
{
|
||||
QFile file(path);
|
||||
if (!file.open(QFile::ReadOnly))
|
||||
{
|
||||
throw std::runtime_error(QString("failed to open %1").arg(path).toStdString());
|
||||
}
|
||||
|
||||
QByteArray data;
|
||||
data.resize(file.size());
|
||||
if (file.read(data.data(), data.size()) != data.size())
|
||||
{
|
||||
throw std::runtime_error(QString("failed to read %1").arg(path).toStdString());
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
bool Utils::fileExists(const QString &path) {
|
||||
QFileInfo check_file(path);
|
||||
return check_file.exists() && check_file.isFile();
|
||||
|
||||
Reference in New Issue
Block a user