aboutsummaryrefslogtreecommitdiffstats
path: root/src/tools/qtcreatorcrashhandler/utils.cpp
blob: a69ef6f1e2d60f2df526c95389f9043616111401 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0

#include "utils.h"

#include <QDebug>
#include <QFile>

QByteArray fileContents(const QString &filePath)
{
    QFile file(filePath);
    if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) {
        qWarning("Warning: Could not open '%s'.", qPrintable(filePath));
        return QByteArray();
    }
    return file.readAll();
}