mirror of
https://github.com/ONLYOFFICE/desktop-apps.git
synced 2026-04-07 14:09:22 +08:00
Merge pull request 'Fix bug 77624' (#501) from fix/license-search into hotfix/v9.2.0
This commit is contained in:
@ -39,6 +39,7 @@
|
|||||||
|
|
||||||
#include <QJsonObject>
|
#include <QJsonObject>
|
||||||
#include <QJsonDocument>
|
#include <QJsonDocument>
|
||||||
|
#include <QDir>
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
|
|
||||||
#define DEFAULT_LICENSE_NAME "GNU AGPL v3"
|
#define DEFAULT_LICENSE_NAME "GNU AGPL v3"
|
||||||
@ -56,12 +57,20 @@ void CMainWindowImpl::refreshAboutVersion()
|
|||||||
QJsonObject _json_obj;
|
QJsonObject _json_obj;
|
||||||
|
|
||||||
auto _read_license_name = [](const QString& path) -> QString {
|
auto _read_license_name = [](const QString& path) -> QString {
|
||||||
QFile f(path);
|
QFileInfo fi(path);
|
||||||
|
QDir dir = fi.dir();
|
||||||
|
QStringList files = dir.entryList(QStringList() << fi.fileName(),
|
||||||
|
QDir::Files, QDir::Name | QDir::IgnoreCase);
|
||||||
|
if (files.isEmpty())
|
||||||
|
return QString();
|
||||||
|
|
||||||
|
QString correctPath = dir.filePath(files.first());
|
||||||
|
QFile f(correctPath);
|
||||||
QString n;
|
QString n;
|
||||||
if ( f.exists(path) ) {
|
if ( f.exists() ) {
|
||||||
if ( f.open(QIODevice::ReadOnly | QIODevice::Text )) {
|
if ( f.open(QIODevice::ReadOnly | QIODevice::Text )) {
|
||||||
QTextStream stream(&f);
|
QTextStream stream(&f);
|
||||||
n = f.readLine().trimmed();
|
n = stream.readLine().trimmed();
|
||||||
f.close();
|
f.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user