Skip to content

Commit 3fd8ba8

Browse files
committed
Make sure the folder `~/.ShadowsocksX-NG` exists.
1 parent 3fa0945 commit 3fd8ba8

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

ShadowsocksX-NG/LaunchAgentUtils.swift

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,15 @@ func InstallPrivoxy() {
335335
}
336336
}
337337

338-
let userConfigPath = homeDir + USER_CONFIG_DIR + "user-privoxy.config"
338+
let userConfigDir = homeDir + USER_CONFIG_DIR
339+
// Make dir: '~/.ShadowsocksX-NG'
340+
if !fileMgr.fileExists(atPath: userConfigDir) {
341+
try! fileMgr.createDirectory(atPath: userConfigDir
342+
, withIntermediateDirectories: true, attributes: nil)
343+
}
344+
345+
// Install empty `user-privoxy.config` file.
346+
let userConfigPath = userConfigDir + "user-privoxy.config"
339347
if !fileMgr.fileExists(atPath: userConfigPath) {
340348
let srcPath = Bundle.main.path(forResource: "user-privoxy", ofType: "config")!
341349
try! fileMgr.copyItem(atPath: srcPath, toPath: userConfigPath)

ShadowsocksX-NG/PACUtils.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ func SyncPac() {
3636
}
3737

3838
let fileMgr = FileManager.default
39-
if !fileMgr.fileExists(atPath: PACRulesDirPath) {
39+
if !fileMgr.fileExists(atPath: PACFilePath) {
4040
needGenerate = true
4141
}
4242

0 commit comments

Comments
 (0)