From 19c8d047ebe4f2cbefe2fcaffa0ecc7925b999e3 Mon Sep 17 00:00:00 2001 From: Qiu Yuzhou Date: Sat, 16 Sep 2017 17:11:22 +0800 Subject: [PATCH] Quote script path in Apple Script. --- ShadowsocksX-NG/AppDelegate.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ShadowsocksX-NG/AppDelegate.swift b/ShadowsocksX-NG/AppDelegate.swift index a90f763b..02426916 100755 --- a/ShadowsocksX-NG/AppDelegate.swift +++ b/ShadowsocksX-NG/AppDelegate.swift @@ -57,7 +57,7 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserNotificationCenterDele if attrs[FileAttributeKey.ownerAccountName] as! String != NSUserName() { //try fileMgr.setAttributes([FileAttributeKey.ownerAccountName: NSUserName()], ofItemAtPath: dirPath) let bashFilePath = Bundle.main.path(forResource: "fix_dir_owner.sh", ofType: nil)! - let script = "do shell script \"bash \(bashFilePath) \(NSUserName()) \" with administrator privileges" + let script = "do shell script \"bash \\\"(bashFilePath)\\\" \(NSUserName()) \" with administrator privileges" if let appleScript = NSAppleScript(source: script) { var err: NSDictionary? = nil appleScript.executeAndReturnError(&err)