From 1976c4caed71ff078cf3fd66d38b3f6c01b68747 Mon Sep 17 00:00:00 2001 From: ctrlaltca Date: Wed, 8 Apr 2020 23:34:57 +0200 Subject: [PATCH] macOS: test a simple way to bypass apptranslocation (#3944) --- cockatrice/src/window_main.cpp | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/cockatrice/src/window_main.cpp b/cockatrice/src/window_main.cpp index 5749dbed..f813070a 100644 --- a/cockatrice/src/window_main.cpp +++ b/cockatrice/src/window_main.cpp @@ -1087,12 +1087,21 @@ void MainWindow::actCheckCardUpdates() QDir dir = QDir(QApplication::applicationDirPath()); #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(); - // exit from the application bundle - dir.cdUp(); - dir.cdUp(); - dir.cdUp(); dir.cd(binaryName + ".app"); dir.cd("Contents"); dir.cd("MacOS");