From 8128d5a48c8a0d730de9f432f81164f00f39c434 Mon Sep 17 00:00:00 2001 From: Qiu Yuzhou Date: Sun, 16 Sep 2018 00:37:58 +0800 Subject: [PATCH] Add folder plugins to the enviroment variable DYLD_LIBRARY_PATH. --- ShadowsocksX-NG/LaunchAgentUtils.swift | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/ShadowsocksX-NG/LaunchAgentUtils.swift b/ShadowsocksX-NG/LaunchAgentUtils.swift index 58fcf43..318afad 100644 --- a/ShadowsocksX-NG/LaunchAgentUtils.swift +++ b/ShadowsocksX-NG/LaunchAgentUtils.swift @@ -59,13 +59,18 @@ func generateSSLocalLauchAgentPlist() -> Bool { arguments.append("--reuse-port") // 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 = [ "Label": "com.qiuyuzhou.shadowsocksX-NG.local", "WorkingDirectory": NSHomeDirectory() + APP_SUPPORT_DIR, "StandardOutPath": logFilePath, "StandardErrorPath": logFilePath, "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) let Sha1Sum = getFileSHA1Sum(plistFilepath)