fix version not being preserved

This commit is contained in:
SamGondelman 2019-04-22 11:34:58 -07:00
parent 2a7ef5c5bb
commit 98a7e4e711
2 changed files with 6 additions and 10 deletions

View file

@ -15,7 +15,6 @@
#include <QtCore/QEventLoop>
#include <QtCore/QFile>
#include <QtCore/QFileInfo>
#include <QtCore/QJsonDocument>
#include <QtCore/QJsonObject>
#include "Gzip.h"
@ -132,10 +131,10 @@ void DomainBaker::loadLocalFile() {
}
// read the file contents to a JSON document
auto jsonDocument = QJsonDocument::fromJson(fileContents);
_json = QJsonDocument::fromJson(fileContents);
// grab the entities object from the root JSON object
_entities = jsonDocument.object()[ENTITIES_OBJECT_KEY].toArray();
_entities = _json.object()[ENTITIES_OBJECT_KEY].toArray();
if (_entities.isEmpty()) {
// add an error to our list stating that the models file was empty
@ -749,15 +748,10 @@ void DomainBaker::writeNewEntitiesFile() {
// time to write out a main models.json.gz file
// first setup a document with the entities array below the entities key
QJsonDocument entitiesDocument;
QJsonObject rootObject;
rootObject[ENTITIES_OBJECT_KEY] = _entities;
entitiesDocument.setObject(rootObject);
_json.object()[ENTITIES_OBJECT_KEY] = _entities;
// turn that QJsonDocument into a byte array ready for compression
QByteArray jsonByteArray = entitiesDocument.toJson();
QByteArray jsonByteArray = _json.toJson();
// compress the json byte array using gzip
QByteArray compressedJson;

View file

@ -12,6 +12,7 @@
#ifndef hifi_DomainBaker_h
#define hifi_DomainBaker_h
#include <QtCore/QJsonDocument>
#include <QtCore/QJsonArray>
#include <QtCore/QObject>
#include <QtCore/QUrl>
@ -59,6 +60,7 @@ private:
QString _originalOutputPath;
QUrl _destinationPath;
QJsonDocument _json;
QJsonArray _entities;
QHash<QUrl, QSharedPointer<ModelBaker>> _modelBakers;