Signed-off-by: John Parent <john.parent@kitware.com>
This commit is contained in:
John Parent 2024-11-15 20:05:10 -05:00
parent 0765f917a9
commit 9ef7dbaa10
4 changed files with 12 additions and 8 deletions

View File

@ -42,6 +42,7 @@ endif()
if(NOT BUILD_OFFLINE_UPDATER)
configure_file(src/Download.cxx.in ${CMAKE_BINARY_DIR}/Download.cxx @ONLY)
set(ONLINE_SOURCES ${CMAKE_BINARY_DIR}/Download.cxx)
endif()
find_package(Qt6 REQUIRED COMPONENTS Core Network)
@ -51,7 +52,6 @@ set(auto_updater_sources
src/CommandFactory.cxx
src/CommandLine.cxx
src/Downgrade.cxx
${CMAKE_BINARY_DIR}/Download.cxx
src/Manifest.cxx
src/Modify.cxx
src/Package.cxx
@ -60,6 +60,7 @@ set(auto_updater_sources
src/Update.cxx
src/utils.cxx
src/main.cxx
${ONLINE_SOURCES}
${ASSEMBLER_SOURCES}
${RC_FILES}
)

View File

@ -4,6 +4,7 @@
#include <windows.h>
#include <QCoreApplication>
#include <QFile>
namespace gpt4all {
namespace resource {
@ -12,7 +13,7 @@ namespace resource {
class WinInstallerResources : public QObject
{
public:
static int extractAndInstall();
}
static int extractAndInstall(QFile *installerPath);
};
}
}

View File

@ -1,6 +1,7 @@
#include "Resource.h"
using namespace gpt4all::resource
using namespace Qt::Literals::StringLiterals;
using namespace gpt4all::resource;
int WinInstallerResources::extractAndInstall(QFile *installerPath)
@ -27,9 +28,9 @@ int WinInstallerResources::extractAndInstall(QFile *installerPath)
const QString error
= u"ERROR: Could not open temp file: %1 %2"_s.arg(installerPath->fileName());
qWarning() << error;
return nullptr;
return -1;
}
const char* installerdat = (const char*)resource;
installerPath.write(installerdat);
installerPath.close();
installerPath->write(installerdat);
installerPath->close();
}

View File

@ -6,6 +6,7 @@
#include "Embedded.h"
#endif
#include <QStandardPaths>
using namespace gpt4all::state;
@ -21,7 +22,7 @@ void Gpt4AllState::driveOffline()
// if(this->checkForExistingInstall())
// this->removeCurrentInstallation();
#if defined(Q_OS_WINDOWS)
this->installer = new QString(QDir::tempPath() + "gpt4all-installer.exe");
this->installer = new QFile(QDir::tempPath() + "gpt4all-installer.exe");
gpt4all::resource::WinInstallerResources::extractAndInstall(installer);
#elif defined(Q_OS_DARWIN)
QString installer(QDir::tempPath() + "gpt4all-installer.dmg");