Skip to content

Commit

Permalink
Fix LB version string acquisition
Browse files Browse the repository at this point in the history
  • Loading branch information
oblivioncth committed Jul 23, 2023
1 parent 4a96b6e commit 2f6a73b
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 43 deletions.
42 changes: 0 additions & 42 deletions app/src/frontend/launchbox/lb-install.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -304,48 +304,6 @@ void Install::softReset()
QString Install::name() const { return NAME; }
QList<Fe::ImageMode> Install::preferredImageModeOrder() const { return IMAGE_MODE_ORDER; }

QString Install::versionString() const
{
// Try LaunchBox.deps.json
QFile depsJson(mCoreDirectory.path() + '/' + u"LaunchBox.deps.json"_s);
QByteArray settingsData;
Qx::IoOpReport settingsLoadReport = Qx::readBytesFromFile(settingsData, depsJson);

if(!settingsLoadReport.isFailure())
{
// Parse original JSON data
QJsonObject settingsObj = QJsonDocument::fromJson(settingsData).object();

if(!settingsObj.isEmpty())
{
// Get key that should have version
QList<QJsonValue> res = Qx::findAllValues(QJsonValue(settingsObj), u"Unbroken.LaunchBox.Windows");

if(!res.isEmpty() && res.first().isString())
{
// Check for valid version number
Qx::VersionNumber ver = Qx::VersionNumber::fromString(res.first().toString());

if(!ver.isNull())
return ver.toString();
}
}
}

// Try unins000.exe
Qx::FileDetails uninsDetails = Qx::FileDetails::readFileDetails(path() + '/' + u"unins000.exe"_s);
if(!uninsDetails.isNull())
{
Qx::VersionNumber ver = uninsDetails.productVersion();

if(!ver.isNull())
return ver.toString();
}

// Fallback to generic method
return Fe::Install::versionString();
}

Qx::Error Install::prePlatformsImport()
{
if(Qx::Error superErr = Fe::Install::prePlatformsImport(); superErr.isValid())
Expand Down
1 change: 0 additions & 1 deletion app/src/frontend/launchbox/lb-install.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@ class Install : public Fe::Install
// Info
QString name() const override;
QList<Fe::ImageMode> preferredImageModeOrder() const override;
QString versionString() const override;

// Import stage notifier hooks
Qx::Error prePlatformsImport() override;
Expand Down

0 comments on commit 2f6a73b

Please sign in to comment.