macos: Add warning dialog when launching azahar executable directly

This commit is contained in:
OpenSauce04 2026-03-12 17:20:10 +00:00 committed by OpenSauce
parent 6715959382
commit 56a563c239
4 changed files with 29 additions and 0 deletions

View File

@ -116,6 +116,7 @@
#ifdef __APPLE__
#include "common/apple_authorization.h"
#include "common/apple_utils.h"
Q_IMPORT_PLUGIN(QDarwinCameraPermissionPlugin);
#endif
@ -424,6 +425,19 @@ GMainWindow::GMainWindow(Core::System& system_)
show();
#ifdef __APPLE__
if (AppleUtils::IsRunningFromTerminal()) {
QMessageBox::warning(
this, tr("Warning"),
tr("The `azahar` executable is being run directly rather than via the Azahar.app "
"bundle.\n\n"
"When run this way, the app may be missing certain functionality such as camera "
"emulation.\n\n"
"It is recommended to instead run Azahar using the `open` command, e.g.:\n"
"`open ./Azahar.app`"));
}
#endif
#ifdef ENABLE_QT_UPDATE_CHECKER
if (UISettings::values.check_for_update_on_start) {
update_future = QtConcurrent::run([]() -> QString {

View File

@ -120,6 +120,7 @@ if (APPLE AND NOT ENABLE_LIBRETRO)
target_sources(citra_common PUBLIC
apple_authorization.h
apple_authorization.cpp
apple_utils.cpp
apple_utils.h
apple_utils.mm
)

View File

@ -0,0 +1,13 @@
// Copyright Citra Emulator Project / Azahar Emulator Project
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#include <unistd.h>
namespace AppleUtils {
bool IsRunningFromTerminal() {
return (getppid() != 1);
}
} // namespace AppleUtils

View File

@ -6,5 +6,6 @@ namespace AppleUtils {
float GetRefreshRate();
int IsLowPowerModeEnabled();
bool IsRunningFromTerminal();
} // namespace AppleUtils