@@ -32,6 +32,7 @@ func generateSSLocalLauchAgentPlist() -> Bool {
32
32
let sslocalPath = NSHomeDirectory ( ) + APP_SUPPORT_DIR + " ss-local/ss-local "
33
33
let logFilePath = NSHomeDirectory ( ) + " /Library/Logs/ss-local.log "
34
34
let launchAgentDirPath = NSHomeDirectory ( ) + LAUNCH_AGENT_DIR
35
+ let plistTempFilepath = NSHomeDirectory ( ) + APP_SUPPORT_DIR + LAUNCH_AGENT_CONF_SSLOCAL_NAME
35
36
let plistFilepath = launchAgentDirPath + LAUNCH_AGENT_CONF_SSLOCAL_NAME
36
37
37
38
// Ensure launch agent directory is existed.
@@ -69,9 +70,10 @@ func generateSSLocalLauchAgentPlist() -> Bool {
69
70
" ProgramArguments " : arguments,
70
71
" EnvironmentVariables " : [ " DYLD_LIBRARY_PATH " : dyld_library_paths. joined ( separator: " : " ) ]
71
72
]
72
- dict. write ( toFile: plistFilepath , atomically: true )
73
- let Sha1Sum = getFileSHA1Sum ( plistFilepath )
73
+ dict. write ( toFile: plistTempFilepath , atomically: true )
74
+ let Sha1Sum = getFileSHA1Sum ( plistTempFilepath )
74
75
if oldSha1Sum != Sha1Sum {
76
+ dict. write ( toFile: plistFilepath, atomically: true )
75
77
NSLog ( " generateSSLocalLauchAgentPlist - File has been changed. " )
76
78
return true
77
79
} else {
@@ -283,6 +285,7 @@ func generatePrivoxyLauchAgentPlist() -> Bool {
283
285
let privoxyPath = NSHomeDirectory ( ) + APP_SUPPORT_DIR + " privoxy/privoxy "
284
286
let logFilePath = NSHomeDirectory ( ) + " /Library/Logs/privoxy.log "
285
287
let launchAgentDirPath = NSHomeDirectory ( ) + LAUNCH_AGENT_DIR
288
+ let plistTempFilePath = NSHomeDirectory ( ) + APP_SUPPORT_DIR + LAUNCH_AGENT_CONF_PRIVOXY_NAME
286
289
let plistFilepath = launchAgentDirPath + LAUNCH_AGENT_CONF_PRIVOXY_NAME
287
290
288
291
// Ensure launch agent directory is existed.
@@ -303,9 +306,10 @@ func generatePrivoxyLauchAgentPlist() -> Bool {
303
306
" StandardErrorPath " : logFilePath,
304
307
" ProgramArguments " : arguments
305
308
]
306
- dict. write ( toFile: plistFilepath , atomically: true )
307
- let Sha1Sum = getFileSHA1Sum ( plistFilepath )
309
+ dict. write ( toFile: plistTempFilePath , atomically: true )
310
+ let Sha1Sum = getFileSHA1Sum ( plistTempFilePath )
308
311
if oldSha1Sum != Sha1Sum {
312
+ dict. write ( toFile: plistFilepath, atomically: true )
309
313
return true
310
314
} else {
311
315
return false
0 commit comments