fix: Linux compiling

Made it so that the updater stuff is windows only.

Signed-off-by: Boss.sfc <boss.sfc@citron-emu.org>
This commit is contained in:
Boss.sfc
2025-09-14 18:46:18 +07:00
parent 94119302ec
commit a3c4f0614a
6 changed files with 33 additions and 6 deletions

View File

@@ -164,7 +164,9 @@ static FileSys::VirtualFile VfsDirectoryCreateFileWrapper(const FileSys::Virtual
#include "citron/play_time_manager.h" #include "citron/play_time_manager.h"
#include "citron/startup_checks.h" #include "citron/startup_checks.h"
#include "citron/uisettings.h" #include "citron/uisettings.h"
#ifdef _WIN32
#include "citron/updater/updater_dialog.h" #include "citron/updater/updater_dialog.h"
#endif
#include "citron/updater/updater_service.h" #include "citron/updater/updater_service.h"
#include "citron/util/clickable_label.h" #include "citron/util/clickable_label.h"
#include "citron/util/performance_overlay.h" #include "citron/util/performance_overlay.h"
@@ -5562,6 +5564,7 @@ int main(int argc, char* argv[]) {
} }
void GMainWindow::OnCheckForUpdates() { void GMainWindow::OnCheckForUpdates() {
#ifdef _WIN32
// Use HTTP URL to bypass SSL issues (will be redirected to HTTPS but handled by updater) // Use HTTP URL to bypass SSL issues (will be redirected to HTTPS but handled by updater)
// TODO: Fix SSL libraries and revert to https://releases.citron-emu.org/api/check // TODO: Fix SSL libraries and revert to https://releases.citron-emu.org/api/check
std::string update_url = "http://releases.citron-emu.org/api/check"; std::string update_url = "http://releases.citron-emu.org/api/check";
@@ -5571,6 +5574,10 @@ void GMainWindow::OnCheckForUpdates() {
updater_dialog->setAttribute(Qt::WA_DeleteOnClose); updater_dialog->setAttribute(Qt::WA_DeleteOnClose);
updater_dialog->show(); updater_dialog->show();
updater_dialog->CheckForUpdates(update_url); updater_dialog->CheckForUpdates(update_url);
#else
QMessageBox::information(this, tr("Updates"),
tr("The update dialog is only available on Windows in this build."));
#endif
} }
void GMainWindow::CheckForUpdatesAutomatically() { void GMainWindow::CheckForUpdatesAutomatically() {

View File

@@ -1,3 +1,4 @@
#ifdef _WIN32
// SPDX-FileCopyrightText: Copyright 2025 citron Emulator Project // SPDX-FileCopyrightText: Copyright 2025 citron Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later // SPDX-License-Identifier: GPL-2.0-or-later
@@ -351,3 +352,5 @@ QString UpdaterDialog::GetUpdateMessage(Updater::UpdaterService::UpdateResult re
} }
#include "updater_dialog.moc" #include "updater_dialog.moc"
#endif // _WIN32

View File

@@ -3,6 +3,8 @@
#pragma once #pragma once
#ifdef _WIN32
#include <memory> #include <memory>
#include <QDialog> #include <QDialog>
#include <QProgressBar> #include <QProgressBar>
@@ -84,3 +86,5 @@ private:
qint64 downloaded_bytes = 0; qint64 downloaded_bytes = 0;
QTimer* progress_timer; QTimer* progress_timer;
}; };
#endif // _WIN32

View File

@@ -594,12 +594,19 @@ bool UpdaterService::ExtractArchive(const std::filesystem::path& archive_path, c
return !cancel_requested.load(); return !cancel_requested.load();
#else #else
#ifdef _WIN32
// Windows fallback: use system 7zip or PowerShell // Windows fallback: use system 7zip or PowerShell
return ExtractArchiveWindows(archive_path, extract_path); return ExtractArchiveWindows(archive_path, extract_path);
#else
LOG_ERROR(Frontend, "Archive extraction requires libarchive on this platform.");
(void)archive_path;
(void)extract_path;
return false;
#endif
#endif #endif
} }
#ifndef CITRON_ENABLE_LIBARCHIVE #if defined(_WIN32) && !defined(CITRON_ENABLE_LIBARCHIVE)
bool UpdaterService::ExtractArchiveWindows(const std::filesystem::path& archive_path, const std::filesystem::path& extract_path) { bool UpdaterService::ExtractArchiveWindows(const std::filesystem::path& archive_path, const std::filesystem::path& extract_path) {
// Create extraction directory // Create extraction directory
EnsureDirectoryExists(extract_path); EnsureDirectoryExists(extract_path);
@@ -921,5 +928,6 @@ bool UpdaterService::ApplyStagedUpdate(const std::filesystem::path& app_director
} }
} // namespace Updater } // namespace Updater
#ifdef _WIN32
#include "updater_service.moc" #include "updater_service.moc"
#endif

View File

@@ -86,7 +86,7 @@ private:
// File operations // File operations
bool ExtractArchive(const std::filesystem::path& archive_path, const std::filesystem::path& extract_path); bool ExtractArchive(const std::filesystem::path& archive_path, const std::filesystem::path& extract_path);
#ifndef CITRON_ENABLE_LIBARCHIVE #if defined(_WIN32) && !defined(CITRON_ENABLE_LIBARCHIVE)
bool ExtractArchiveWindows(const std::filesystem::path& archive_path, const std::filesystem::path& extract_path); bool ExtractArchiveWindows(const std::filesystem::path& archive_path, const std::filesystem::path& extract_path);
#endif #endif
bool InstallUpdate(const std::filesystem::path& update_path); bool InstallUpdate(const std::filesystem::path& update_path);

View File

@@ -24,3 +24,8 @@
#undef False #undef False
#undef None #undef None
#undef True #undef True
#undef Success
#undef KeyPress
#undef KeyRelease
#undef FocusIn
#undef FocusOut