Merge pull request #460 from AdenKoperczak/flatpak_build

Add a Flatpak Builld
This commit is contained in:
Dan Paulat 2025-06-07 14:58:40 -05:00 committed by GitHub
commit fbacb7dc13
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 91 additions and 1 deletions

View file

@ -1,6 +1,8 @@
#include <scwx/qt/manager/log_manager.hpp>
#include <scwx/util/logger.hpp>
#include <cstdlib>
#include <ctime>
#include <filesystem>
#include <map>
#include <ranges>
@ -57,6 +59,14 @@ void LogManager::InitializeLogFile()
QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation)
.toStdString();
p->pid_ = boost::this_process::get_id();
if (p->pid_ == 2)
{
// The pid == 2 means that this is likely a flatpak. We assign a random
// number in this case to avoid overlap, scince it is always 2 in a
// flatpak
std::srand(std::time({}));
p->pid_ = std::rand();
}
p->logFile_ = fmt::format("{}/supercell-wx.{}.log", p->logPath_, p->pid_);
// Create log directory if it doesn't exist