From 7e1dc05b175f1ea4ba5c10333c1f04cc802a3e79 Mon Sep 17 00:00:00 2001 From: Charlie Qiu Date: Wed, 3 Aug 2016 23:45:46 +0800 Subject: [PATCH] =?UTF-8?q?Fix=20bug=20#23:=20=E6=B2=A1=E6=9C=89~/Library/?= =?UTF-8?q?LaunchAgents=E6=96=87=E4=BB=B6=E5=A4=B9=E5=90=AF=E5=8A=A8?= =?UTF-8?q?=E6=95=85=E9=9A=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ShadowsocksX-NG/LaunchAgentUtils.swift | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/ShadowsocksX-NG/LaunchAgentUtils.swift b/ShadowsocksX-NG/LaunchAgentUtils.swift index a00a9c1..ca0deac 100644 --- a/ShadowsocksX-NG/LaunchAgentUtils.swift +++ b/ShadowsocksX-NG/LaunchAgentUtils.swift @@ -26,7 +26,14 @@ func getFileSHA1Sum(filepath: String) -> String { func generateSSLocalLauchAgentPlist() -> Bool { let sslocalPath = NSHomeDirectory() + APP_SUPPORT_DIR + "ss-local" let logFilePath = NSHomeDirectory() + "/Library/Logs/ss-local.log" - let plistFilepath = NSHomeDirectory() + LAUNCH_AGENT_DIR + LAUNCH_AGENT_CONF_NAME + let launchAgentDirPath = NSHomeDirectory() + LAUNCH_AGENT_DIR + let plistFilepath = launchAgentDirPath + LAUNCH_AGENT_CONF_NAME + + // Ensure launch agent directory is existed. + let fileMgr = NSFileManager.defaultManager() + if !fileMgr.fileExistsAtPath(launchAgentDirPath) { + try! fileMgr.createDirectoryAtPath(launchAgentDirPath, withIntermediateDirectories: true, attributes: nil) + } let oldSha1Sum = getFileSHA1Sum(plistFilepath)