chore: suggested changes

This commit is contained in:
Vlad Frangu 2023-11-11 21:39:40 +02:00
parent 7a64e54dfe
commit 533aeeeb51
No known key found for this signature in database
GPG key ID: 9E307D4EA83977AC

View file

@ -6,24 +6,25 @@ let vendettaLog = OSLog(subsystem: Bundle.main.bundleIdentifier!, category: "ven
let source = URL(string: "vendetta")!
let install_prefix = String(cString: get_install_prefix())
let isJailbroken = FileManager.default.fileExists(atPath: "\(install_prefix)/Library/Application Support/VendettaTweak/VendettaPatches.bundle")
let vendettaPatchesBundlePath =
FileManager.default.fileExists(
atPath: "\(install_prefix)/Library/Application Support/VendettaTweak/VendettaPatches.bundle")
? "\(install_prefix)/Library/Application Support/VendettaTweak/VendettaPatches.bundle"
: "\(Bundle.main.bundleURL.path)/VendettaPatches.bundle"
let vendettaPatchesBundlePath = if isJailbroken {
"\(install_prefix)/Library/Application Support/VendettaTweak/VendettaPatches.bundle"
} else {
"\(Bundle.main.bundleURL.path)/VendettaPatches.bundle"
}
class FileManagerLoadHook: ClassHook<FileManager> {
func containerURLForSecurityApplicationGroupIdentifier(_ groupIdentifier: NSString?) -> URL? {
os_log("containerURLForSecurityApplicationGroupIdentifier called! %{public}@ groupIdentifier", log: vendettaLog, type: .debug, groupIdentifier ?? "nil")
if groupIdentifier != nil {
let paths = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask)
let lastPath = paths.last!
return lastPath.appendingPathComponent("AppGroup")
if (isJailbroken) {
return orig.containerURLForSecurityApplicationGroupIdentifier(groupIdentifier)
}
return orig.containerURLForSecurityApplicationGroupIdentifier(groupIdentifier)
let paths = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask)
let lastPath = paths.last!
return lastPath.appendingPathComponent("AppGroup")
}
}