2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 06:26:18 +00:00

Have a global Core::Launcher accessor

This allows to use Launcher in code executing before Sandbox is created
This commit is contained in:
Ilya Fedin
2023-06-13 04:34:27 +04:00
committed by John Preston
parent 63ccf1bed4
commit a7bd097b2f
13 changed files with 50 additions and 70 deletions

View File

@@ -20,6 +20,12 @@ public:
static std::unique_ptr<Launcher> Create(int argc, char *argv[]);
static Launcher &Instance() {
Expects(InstanceSetter::Instance != nullptr);
return *InstanceSetter::Instance;
}
virtual int exec();
QString argumentsString() const;
@@ -32,7 +38,7 @@ public:
void writeDebugModeSetting();
void writeInstallBetaVersionsSetting();
virtual ~Launcher() = default;
virtual ~Launcher();
protected:
enum class UpdaterLaunch {
@@ -61,6 +67,17 @@ private:
int executeApplication();
struct InstanceSetter {
InstanceSetter(not_null<Launcher*> instance) {
Expects(Instance == nullptr);
Instance = instance;
}
static Launcher *Instance;
};
InstanceSetter _setter = { this };
int _argc;
char **_argv;
QStringList _arguments;