Skip to content

Commit

Permalink
fix restart
Browse files Browse the repository at this point in the history
  • Loading branch information
arm64v8a committed Apr 2, 2023
1 parent a88712a commit 46bad85
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 8 deletions.
1 change: 1 addition & 0 deletions main/NekoRay_DataStore.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ namespace NekoRay {
int resolve_count = 0;

// Flags
QStringList argv = {};
bool flag_use_appdata = false;
bool flag_many = false;
bool flag_tray = false;
Expand Down
10 changes: 5 additions & 5 deletions main/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,11 @@ int main(int argc, char *argv[]) {
#endif

// Flags
auto args = QApplication::arguments();
if (args.contains("-many")) NekoRay::dataStore->flag_many = true;
if (args.contains("-appdata")) NekoRay::dataStore->flag_use_appdata = true;
if (args.contains("-tray")) NekoRay::dataStore->flag_tray = true;
if (args.contains("-debug")) NekoRay::dataStore->flag_debug = true;
NekoRay::dataStore->argv = QApplication::arguments();
if (NekoRay::dataStore->argv.contains("-many")) NekoRay::dataStore->flag_many = true;
if (NekoRay::dataStore->argv.contains("-appdata")) NekoRay::dataStore->flag_use_appdata = true;
if (NekoRay::dataStore->argv.contains("-tray")) NekoRay::dataStore->flag_tray = true;
if (NekoRay::dataStore->argv.contains("-debug")) NekoRay::dataStore->flag_debug = true;
#ifdef NKR_CPP_USE_APPDATA
NekoRay::dataStore->flag_use_appdata = true; // Example: Package & MacOS
#endif
Expand Down
1 change: 1 addition & 0 deletions sys/ExternalProcess.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "ExternalProcess.hpp"
#include "main/NekoRay.hpp"

#include <QTimer>
#include <QDir>
Expand Down
2 changes: 0 additions & 2 deletions sys/ExternalProcess.hpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#pragma once

#include "main/NekoRay.hpp"

#include <QProcess>

namespace NekoRay::sys {
Expand Down
4 changes: 3 additions & 1 deletion ui/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -627,7 +627,9 @@ void MainWindow::on_menu_exit_triggered() {
QProcess::startDetached("./updater", QStringList{});
} else if (exit_reason == 2) {
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();
QCoreApplication::quit();
Expand Down

0 comments on commit 46bad85

Please sign in to comment.