Skip to content

Commit

Permalink
[Release] Release version 0.5.0
Browse files Browse the repository at this point in the history
- Fix program crash in release build;

Signed-off-by: IoeCmcomc <[email protected]>
  • Loading branch information
IoeCmcomc committed Sep 5, 2022
1 parent e4d5ffc commit 34ea112
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 9 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright [yyyy] [name of copyright owner]
Copyright 2020-2022 IoeCmcomc

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ int main(int argc, char *argv[]) {

QCoreApplication::setOrganizationName("IoeCmcomc");
QCoreApplication::setApplicationName("MCDatapacker");
QCoreApplication::setApplicationVersion("0.4.0");
QCoreApplication::setApplicationVersion("0.5.0");

/*Q_INIT_RESOURCE(application); */

Expand Down
14 changes: 9 additions & 5 deletions src/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#include <QShortcut>
#include <QClipboard>
#include <QProgressDialog>
#include <QSaveFile>


QMap<QString, QVariantMap> MainWindow::MCRInfoMaps;
Expand Down Expand Up @@ -100,8 +101,8 @@ MainWindow::MainWindow(QWidget *parent)
connect(updater, &QSimpleUpdater::downloadFinished,
this, &MainWindow::installUpdate);

const auto &&oldProgramFile = qApp->applicationDirPath() +
QLatin1String("/MCDatapacker_old");
const auto &oldProgramFile = qApp->applicationDirPath() +
QLatin1String("/MCDatapacker_old");
if (QFile::exists(oldProgramFile))
QFile::remove(oldProgramFile);
}
Expand Down Expand Up @@ -778,7 +779,7 @@ void MainWindow::installUpdate(const QString &url, const QString &filepath) {
const auto appDirPath = qApp->applicationDirPath();
qDebug() << filepath << appDirPath << qApp->arguments()[0];
QFile::rename(qApp->arguments()[0],
appDirPath + QLatin1String("/MCDatapacker_old"));
appDirPath + "/MCDatapacker_old");
zip_file zipFile{ filepath.toStdString() };

/* zipFile.printdir(); */
Expand All @@ -800,17 +801,20 @@ void MainWindow::installUpdate(const QString &url, const QString &filepath) {
if (filename.rightRef(1) == '/') {
dir.mkpath(filename);
} else {
QFile file(appDirPath + QLatin1Char('/') + filename);
QSaveFile file(appDirPath + QLatin1Char('/') + filename);
if (!file.open(QIODevice::WriteOnly))
return;

const auto &&fileData = zipFile.read(info);
file.write(fileData.c_str(), fileData.size());
file.close();
file.commit();
}
i++;
}

/* QLatin1String("/QSU_Update.bin") crashes the program in release build */
QFile::remove(appDirPath + QStringLiteral("/QSU_Update.bin"));

progress.setValue(progress.maximum());

QFile::rename(appDirPath + QLatin1String("/MCDatapacker.exe"),
Expand Down
4 changes: 2 additions & 2 deletions src/src.pro
Original file line number Diff line number Diff line change
Expand Up @@ -250,12 +250,12 @@ qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target

VERSION = 0.4.0
VERSION = 0.5.0
QMAKE_TARGET_COMPANY = IoeCmcomc
QMAKE_TARGET = MCDatapacker
QMAKE_TARGET_PRODUCT = MCDatapacker
QMAKE_TARGET_DESCRIPTION = MCDatapacker - Minecraft datapack editor
QMAKE_TARGET_COPYRIGHT = \\251 2020 - 2021 IoeCmcomc
QMAKE_TARGET_COPYRIGHT = \\251 2020 - 2022 IoeCmcomc


win32:CONFIG(release, debug|release): LIBS += -L$$OUT_PWD/../lib/json/release/ -ljson
Expand Down

0 comments on commit 34ea112

Please sign in to comment.