mirror of
https://github.com/ONLYOFFICE/desktop-apps.git
synced 2026-02-10 18:05:16 +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 <QJsonDocument>
|
||||
#include <QDir>
|
||||
#include <QFile>
|
||||
|
||||
#define DEFAULT_LICENSE_NAME "GNU AGPL v3"
|
||||
@ -56,12 +57,20 @@ void CMainWindowImpl::refreshAboutVersion()
|
||||
QJsonObject _json_obj;
|
||||
|
||||
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;
|
||||
if ( f.exists(path) ) {
|
||||
if ( f.exists() ) {
|
||||
if ( f.open(QIODevice::ReadOnly | QIODevice::Text )) {
|
||||
QTextStream stream(&f);
|
||||
n = f.readLine().trimmed();
|
||||
n = stream.readLine().trimmed();
|
||||
f.close();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user