Add folder plugins to the enviroment variable DYLD_LIBRARY_PATH.

This commit is contained in:
Qiu Yuzhou
2018-09-16 00:37:58 +08:00
parent dbcd27833c
commit 8128d5a48c

View File

@ -59,13 +59,18 @@ func generateSSLocalLauchAgentPlist() -> Bool {
arguments.append("--reuse-port") arguments.append("--reuse-port")
// For a complete listing of the keys, see the launchd.plist manual page. // For a complete listing of the keys, see the launchd.plist manual page.
let dyld_library_paths = [
NSHomeDirectory() + APP_SUPPORT_DIR + "ss-local-latest/",
NSHomeDirectory() + APP_SUPPORT_DIR + "plugins/",
]
let dict: NSMutableDictionary = [ let dict: NSMutableDictionary = [
"Label": "com.qiuyuzhou.shadowsocksX-NG.local", "Label": "com.qiuyuzhou.shadowsocksX-NG.local",
"WorkingDirectory": NSHomeDirectory() + APP_SUPPORT_DIR, "WorkingDirectory": NSHomeDirectory() + APP_SUPPORT_DIR,
"StandardOutPath": logFilePath, "StandardOutPath": logFilePath,
"StandardErrorPath": logFilePath, "StandardErrorPath": logFilePath,
"ProgramArguments": arguments, "ProgramArguments": arguments,
"EnvironmentVariables": ["DYLD_LIBRARY_PATH": NSHomeDirectory() + APP_SUPPORT_DIR + "ss-local-latest/"] "EnvironmentVariables": ["DYLD_LIBRARY_PATH": dyld_library_paths.joined(separator: ":")]
] ]
dict.write(toFile: plistFilepath, atomically: true) dict.write(toFile: plistFilepath, atomically: true)
let Sha1Sum = getFileSHA1Sum(plistFilepath) let Sha1Sum = getFileSHA1Sum(plistFilepath)