fix #4: change Resources Permission

This commit is contained in:
yanue 2018-12-04 17:11:24 +08:00
parent 4f6fb88aa8
commit 926cdfb741
3 changed files with 9 additions and 5 deletions

View File

@ -414,7 +414,6 @@ class ConfigWindowController: NSWindowController, NSWindowDelegate, NSTabViewDel
// quic
self.quicKey.stringValue = v2rayConfig.streamQuic.key
print(" v2rayConfig.streamQuic.security", v2rayConfig.streamQuic.security, v2rayConfig.streamQuic.header.type)
self.quicSecurity.selectItem(withTitle: v2rayConfig.streamQuic.security)
self.quicHeaderType.selectItem(withTitle: v2rayConfig.streamQuic.header.type)

View File

@ -134,7 +134,7 @@ class V2rayCore {
// unzip v2ray-core
// cmd: /bin/bash -c 'cd path && ./unzip.sh '
let sh = "cd " + AppResourcesPath + " && ./unzip.sh && /bin/chmod 777 ./v2ray-core"
let sh = "cd " + AppResourcesPath + " && ./unzip.sh && /bin/chmod -R 777 ./v2ray-core"
// exec shell
let res = shell(launchPath: "/bin/bash", arguments: ["-c", sh])
NSLog("res:", res!)

View File

@ -28,7 +28,7 @@ class V2rayLaunch: NSObject {
try! fileMgr.createDirectory(atPath: launchAgentDirPath, withIntermediateDirectories: true, attributes: nil)
}
let arguments = [v2rayCoreFile, "-config", "config.json"]
let arguments = ["./v2ray-core/v2ray", "-config", "config.json"]
let dict: NSMutableDictionary = [
"Label": LAUNCH_AGENT_PLIST.replacingOccurrences(of: ".plist", with: ""),
@ -40,14 +40,19 @@ class V2rayLaunch: NSObject {
"RunAtLoad": true,
]
_ = shell(launchPath: "/bin/bash", arguments: ["-c", "cd " + AppResourcesPath + " && /bin/chmod -R 755 ."])
dict.write(toFile: launchAgentPlistFile, atomically: true)
}
static func Start() {
// permission: make v2ray execable
_ = shell(launchPath: "/bin/bash", arguments: ["-c", "cd " + AppResourcesPath + " && /bin/chmod 777 ./v2ray-core"])
// ~/LaunchAgents/yanue.v2rayu.v2ray-core.plist
_ = shell(launchPath: "/bin/bash", arguments: ["-c", "cd " + AppResourcesPath + " && /bin/chmod -R 755 ./v2ray-core"])
// unload first
_ = shell(launchPath: "/bin/launchctl", arguments: ["unload", launchAgentPlistFile])
// 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()
if task.terminationStatus == 0 {