update version: 0.9.9

This commit is contained in:
yanue 2018-11-28 10:16:47 +08:00
parent d08e2e3aff
commit 208c902f0a
2 changed files with 6 additions and 3 deletions

View File

@ -25,7 +25,7 @@ class V2rayCore {
}
let fileMgr = FileManager.default
if !fileMgr.fileExists(atPath: v2rayCoreFullPath) {
if !fileMgr.fileExists(atPath: v2rayCoreFile) {
self.download();
}
}

View File

@ -15,8 +15,8 @@ let logFilePath = NSHomeDirectory() + "/Library/Logs/V2rayU.log"
let launchAgentDirPath = NSHomeDirectory() + LAUNCH_AGENT_DIR
let launchAgentPlistFile = launchAgentDirPath + LAUNCH_AGENT_PLIST
let AppResourcesPath = Bundle.main.bundlePath + "/Contents/Resources"
let v2rayCoreFile = "v2ray-core/v2ray"
let v2rayCoreFullPath = AppResourcesPath + "/" + v2rayCoreFile
let v2rayCorePath = AppResourcesPath + "/v2ray-core"
let v2rayCoreFile = v2rayCorePath + "/v2ray"
class V2rayLaunch: NSObject {
static var authRef: AuthorizationRef?
@ -44,6 +44,9 @@ class V2rayLaunch: NSObject {
}
static func Start() {
// permission: make v2ray execable
_ = shell(launchPath: "/bin/bash", arguments: ["-c", "cd " + AppResourcesPath + " && /bin/chmod 777 ./v2ray-core"])
// cmd: /bin/launchctl load -wF /Users/xxx/Library/LaunchAgents/yanue.v2rayu.v2ray-core.plist
let task = Process.launchedProcess(launchPath: "/bin/launchctl", arguments: ["load", "-wF", launchAgentPlistFile])
task.waitUntilExit()