Plasma
Plasma copied to clipboard
Fix for plFileSystem not finding self on Mac
The code as written should have worked - but Apple seems to have changed the way they do things. There are other reports of /proc/curproc/file disappearing from macOS. I'm not sure when that happened.
This code gets called as part of the patching process - which is why I wrote this change. Patching did not work without this change.
I defined a new implementation - but I realized this will only work if the current process is an app bundle. For a flat executable (like your command line patcher @dpogue), this probably isn't going to work. I'm open to other suggestions - this take is very AppKit centric.
This returns the path to the bundle, so I'm guessing that's the .app "file" and not the actual executable within it?
How cursed is _NSGetExecutablePath? https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man3/dyld.3.html
How cursed is
_NSGetExecutablePath? https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man3/dyld.3.html
Seems workable to me, I wasn't aware it existed.
I'm not sure if it should be the executable path or the bundle path in the case of the Mac client. That might be a question we're not ready for. In since Mac apps are folders that have to be replaced completely in order to not break code signing - we probably don't want the patcher crawling into the bundle. So we'd have to get the patcher to treat the bundle like it was a file, which might require some rethink and extensions to the patcher. I don't know if we could even do something fancy like store the app as a zipfile on the server and have the patcher decompress it into place.
I'm not sure if it should be the executable path or the bundle path in the case of the Mac client.
It might make sense to use the bundle path if it's a bundle, and the executable path if not?
I'm not sure if it should be the executable path or the bundle path in the case of the Mac client.
It might make sense to use the bundle path if it's a bundle, and the executable path if not?
That could be a good path forward. I can implement that. If it doesn't work out when it comes time to actually do patching of the Mac client that could always be changed.
That sounds like a good path forward to me.
I just remembered this one is still open. I'll get back around to implementing the changes.
FYI - this code is no longer being called in the latest version of the Mac patcher. Likely because I've opted out of self patching. But that means it'll likely come back into use. I manually called the function for testing.
Code suggestions have been applied. Waiting to see if they build on CI in since it's difficult for me to build these on Mac without a full client exercising things.
@colincornaby It looks good to me - are you ready for a merge?
Yep! This is ready for merge.