Skip to content

Commit

Permalink
Quote script path in Apple Script.
Browse files Browse the repository at this point in the history
  • Loading branch information
qiuyuzhou committed Sep 16, 2017
1 parent 35c04c7 commit 19c8d04
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion ShadowsocksX-NG/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 19c8d04

Please sign in to comment.