mirror of
https://github.com/MatsuriDayo/nekoray.git
synced 2025-12-17 20:44:38 +03:00
fix restart
This commit is contained in:
@@ -65,6 +65,7 @@ namespace NekoRay {
|
|||||||
int resolve_count = 0;
|
int resolve_count = 0;
|
||||||
|
|
||||||
// Flags
|
// Flags
|
||||||
|
QStringList argv = {};
|
||||||
bool flag_use_appdata = false;
|
bool flag_use_appdata = false;
|
||||||
bool flag_many = false;
|
bool flag_many = false;
|
||||||
bool flag_tray = false;
|
bool flag_tray = false;
|
||||||
|
|||||||
@@ -52,11 +52,11 @@ int main(int argc, char *argv[]) {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Flags
|
// Flags
|
||||||
auto args = QApplication::arguments();
|
NekoRay::dataStore->argv = QApplication::arguments();
|
||||||
if (args.contains("-many")) NekoRay::dataStore->flag_many = true;
|
if (NekoRay::dataStore->argv.contains("-many")) NekoRay::dataStore->flag_many = true;
|
||||||
if (args.contains("-appdata")) NekoRay::dataStore->flag_use_appdata = true;
|
if (NekoRay::dataStore->argv.contains("-appdata")) NekoRay::dataStore->flag_use_appdata = true;
|
||||||
if (args.contains("-tray")) NekoRay::dataStore->flag_tray = true;
|
if (NekoRay::dataStore->argv.contains("-tray")) NekoRay::dataStore->flag_tray = true;
|
||||||
if (args.contains("-debug")) NekoRay::dataStore->flag_debug = true;
|
if (NekoRay::dataStore->argv.contains("-debug")) NekoRay::dataStore->flag_debug = true;
|
||||||
#ifdef NKR_CPP_USE_APPDATA
|
#ifdef NKR_CPP_USE_APPDATA
|
||||||
NekoRay::dataStore->flag_use_appdata = true; // Example: Package & MacOS
|
NekoRay::dataStore->flag_use_appdata = true; // Example: Package & MacOS
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
#include "ExternalProcess.hpp"
|
#include "ExternalProcess.hpp"
|
||||||
|
#include "main/NekoRay.hpp"
|
||||||
|
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "main/NekoRay.hpp"
|
|
||||||
|
|
||||||
#include <QProcess>
|
#include <QProcess>
|
||||||
|
|
||||||
namespace NekoRay::sys {
|
namespace NekoRay::sys {
|
||||||
|
|||||||
@@ -627,7 +627,9 @@ void MainWindow::on_menu_exit_triggered() {
|
|||||||
QProcess::startDetached("./updater", QStringList{});
|
QProcess::startDetached("./updater", QStringList{});
|
||||||
} else if (exit_reason == 2) {
|
} else if (exit_reason == 2) {
|
||||||
QDir::setCurrent(QApplication::applicationDirPath());
|
QDir::setCurrent(QApplication::applicationDirPath());
|
||||||
QProcess::startDetached(qEnvironmentVariable("NKR_FROM_LAUNCHER") == "1" ? "./launcher" : QApplication::applicationFilePath(), QStringList{});
|
auto arguments = NekoRay::dataStore->argv;
|
||||||
|
if (arguments.length() > 0) arguments.removeFirst();
|
||||||
|
QProcess::startDetached(qEnvironmentVariable("NKR_FROM_LAUNCHER") == "1" ? "./launcher" : QApplication::applicationFilePath(), arguments);
|
||||||
}
|
}
|
||||||
tray->hide();
|
tray->hide();
|
||||||
QCoreApplication::quit();
|
QCoreApplication::quit();
|
||||||
|
|||||||
Reference in New Issue
Block a user