mirror of
https://github.com/loot/libloot.git
synced 2026-07-27 14:16:01 -07:00
Tweak getRelease callback
Simplify the JS processing.
This commit is contained in:
@@ -117,16 +117,8 @@
|
||||
document.addEventListener('loot-game-plugins-change', Game.onPluginsChange);
|
||||
}
|
||||
|
||||
function splitVersion(version) {
|
||||
const lastPeriodIndex = version.lastIndexOf('.');
|
||||
return {
|
||||
release: version.substring(0, lastPeriodIndex),
|
||||
build: version.substring(lastPeriodIndex + 1),
|
||||
};
|
||||
}
|
||||
|
||||
function setVersion(appData) {
|
||||
return query('getVersion').then(JSON.parse).then(splitVersion).then((version) => {
|
||||
return query('getVersion').then(JSON.parse).then((version) => {
|
||||
appData.version = version.release;
|
||||
dom.setVersion(version);
|
||||
});
|
||||
|
||||
@@ -27,13 +27,17 @@ along with LOOT. If not, see
|
||||
|
||||
#include "gui/query/query.h"
|
||||
#include "loot/loot_version.h"
|
||||
#include "backend/helpers/json.h"
|
||||
|
||||
namespace loot {
|
||||
class GetVersionQuery : public Query {
|
||||
public:
|
||||
std::string executeLogic() {
|
||||
BOOST_LOG_TRIVIAL(info) << "Getting LOOT version.";
|
||||
return "\"" + LootVersion::string() + "." + LootVersion::revision + "\"";
|
||||
YAML::Node node;
|
||||
node["release"] = LootVersion::string();
|
||||
node["build"] = LootVersion::revision;
|
||||
return JSON::stringify(node);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user