nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at python-updates 47 lines 1.9 kB view raw
1diff --git a/src/global/Configs.cpp b/src/global/Configs.cpp 2index e7bec9c..f0dfe53 100644 3--- a/src/global/Configs.cpp 4+++ b/src/global/Configs.cpp 5@@ -404,6 +404,12 @@ namespace Configs { 6 // System Utils 7 8 QString FindCoreRealPath() { 9+ // find in PATH first 10+ QString path_for_nixos = QStandardPaths::findExecutable("throne-core"); 11+ if (!path_for_nixos.isEmpty()) { 12+ return path_for_nixos; 13+ } 14+ 15 auto fn = QApplication::applicationDirPath() + "/Core"; 16 #ifdef Q_OS_WIN 17 fn += ".exe"; 18diff --git a/src/ui/mainwindow.cpp b/src/ui/mainwindow.cpp 19index d31c311..ce4c357 100644 20--- a/src/ui/mainwindow.cpp 21+++ b/src/ui/mainwindow.cpp 22@@ -151,8 +151,7 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWi 23 Configs::dataStore->core_port = MkPort(); 24 if (Configs::dataStore->core_port <= 0) Configs::dataStore->core_port = 19810; 25 26- auto core_path = QApplication::applicationDirPath() + "/"; 27- core_path += "Core"; 28+ auto core_path = Configs::FindCoreRealPath(); 29 30 QStringList args; 31 args.push_back("-port"); 32@@ -1045,6 +1044,15 @@ bool MainWindow::get_elevated_permissions(int reason) { 33 return true; 34 } 35 if (Configs::IsAdmin()) return true; 36+ QMessageBox::critical( 37+ GetMessageBoxParent(), 38+ tr("Unable to elevate privileges when installed with Nix"), 39+ tr("Due to the read-only property of Nix store, we cannot set suid for throne-core. If you are using NixOS, please set `programs.throne.tunMode.enable` option to elevate privileges."), 40+ QMessageBox::Ok 41+ ); 42+ return false; 43+ // The following code isn't effective, preserve to avoid merge conflict 44+ 45 #ifdef Q_OS_LINUX 46 if (!Linux_HavePkexec()) { 47 MessageBoxWarning(software_name, "Please install \"pkexec\" first.");