openralauncherosx's Issues
App translocation breaks external mod metadata.
macOS >= 10.12 includes a security feature that 'translocates' applications (with a list of exclusions that don't always apply to OpenRA) at runtime to run from a read-only disk image. This breaks our ModMetadata launch paths, giving transient paths that are not repeatable.
e.g.:
LaunchPath: /private/var/folders/wm/1cb20jp50y9_ycdlqlqxhky00000gn/T/AppTranslocation/E917BB1D-A577-4BD3-89B7-A8BA65E6CEAB/d/OpenRA.app/Contents/MacOS/OpenRA
Running from the translocated location isn't a problem so long as we know the original launch path so that we can reliably relaunch the game.
http://lapcatsoftware.com/articles/detect-app-translocation.html contains a code snippet that should let us find the original path:
#include <dlfcn.h> // dlopen, dlclose
bool IsTranslocatedURL(CFURLRef currentURL, CFURLRef *originalURL)
{
if (currentURL == NULL)
{
return false;
}
// #define NSAppKitVersionNumber10_11 1404
if (floor(NSAppKitVersionNumber) <= 1404)
{
return false;
}
void *handle = dlopen("/System/Library/Frameworks/Security.framework/Security", RTLD_LAZY);
if (handle == NULL)
{
return false;
}
bool isTranslocated = false;
Boolean (*mySecTranslocateIsTranslocatedURL)(CFURLRef path, bool *isTranslocated, CFErrorRef * __nullable error);
mySecTranslocateIsTranslocatedURL = dlsym(handle, "SecTranslocateIsTranslocatedURL");
if (mySecTranslocateIsTranslocatedURL != NULL)
{
if (mySecTranslocateIsTranslocatedURL(currentURL, &isTranslocated, NULL))
{
if (isTranslocated)
{
if (originalURL != NULL)
{
CFURLRef __nullable (*mySecTranslocateCreateOriginalPathForURL)(CFURLRef translocatedPath, CFErrorRef * __nullable error);
mySecTranslocateCreateOriginalPathForURL = dlsym(handle, "SecTranslocateCreateOriginalPathForURL");
if (mySecTranslocateCreateOriginalPathForURL != NULL)
{
*originalURL = mySecTranslocateCreateOriginalPathForURL((CFURLRef)currentURL, NULL);
}
else
{
*originalURL = NULL;
}
}
}
}
}
dlclose(handle);
return isTranslocated;
}
View Logs button Does Nothing
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.