macOS: test a simple way to bypass apptranslocation (#3944)

This commit is contained in:
ctrlaltca 2020-04-08 23:34:57 +02:00 committed by GitHub
parent 2c3eab9b0c
commit 1976c4caed
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1087,12 +1087,21 @@ void MainWindow::actCheckCardUpdates()
QDir dir = QDir(QApplication::applicationDirPath()); QDir dir = QDir(QApplication::applicationDirPath());
#if defined(Q_OS_MAC) #if defined(Q_OS_MAC)
/*
* bypass app translocation: quarantined application will be started from a temporary directory eg.
* /private/var/folders/tk/qx76cyb50jn5dvj7rrgfscz40000gn/T/AppTranslocation/A0CBBD5A-9264-4106-8547-36B84DB161E2/d/oracle/
*/
if(dir.absolutePath().startsWith("/private/var/folders")) {
dir.setPath("/Applications/");
} else {
// exit from the Cockatrice application bundle
dir.cdUp();
dir.cdUp();
dir.cdUp();
}
binaryName = getCardUpdaterBinaryName(); binaryName = getCardUpdaterBinaryName();
// exit from the application bundle
dir.cdUp();
dir.cdUp();
dir.cdUp();
dir.cd(binaryName + ".app"); dir.cd(binaryName + ".app");
dir.cd("Contents"); dir.cd("Contents");
dir.cd("MacOS"); dir.cd("MacOS");