2
1
Fork 0
mirror of https://github.com/yuzu-emu/yuzu.git synced 2024-07-04 23:31:19 +01:00

Merge pull request #2797 from FearlessTobi/port-4877

Port citra-emu/citra#4877: "citra_qt: on osx chdir to bundle dir to allow detection of user folder"
This commit is contained in:
David 2019-09-05 12:29:50 +10:00 committed by GitHub
commit 953d49810a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -6,6 +6,9 @@
#include <clocale> #include <clocale>
#include <memory> #include <memory>
#include <thread> #include <thread>
#ifdef __APPLE__
#include <unistd.h> // for chdir
#endif
// VFS includes must be before glad as they will conflict with Windows file api, which uses defines. // VFS includes must be before glad as they will conflict with Windows file api, which uses defines.
#include "applets/error.h" #include "applets/error.h"
@ -2226,6 +2229,14 @@ int main(int argc, char* argv[]) {
QCoreApplication::setOrganizationName(QStringLiteral("yuzu team")); QCoreApplication::setOrganizationName(QStringLiteral("yuzu team"));
QCoreApplication::setApplicationName(QStringLiteral("yuzu")); QCoreApplication::setApplicationName(QStringLiteral("yuzu"));
#ifdef __APPLE__
// If you start a bundle (binary) on OSX without the Terminal, the working directory is "/".
// But since we require the working directory to be the executable path for the location of the
// user folder in the Qt Frontend, we need to cd into that working directory
const std::string bin_path = FileUtil::GetBundleDirectory() + DIR_SEP + "..";
chdir(bin_path.c_str());
#endif
// Enables the core to make the qt created contexts current on std::threads // Enables the core to make the qt created contexts current on std::threads
QCoreApplication::setAttribute(Qt::AA_DontCheckOpenGLContextThreadAffinity); QCoreApplication::setAttribute(Qt::AA_DontCheckOpenGLContextThreadAffinity);
QApplication app(argc, argv); QApplication app(argc, argv);