Make sure the folder `~/.ShadowsocksX-NG` exists.
This commit is contained in:
Qiu Yuzhou
2019-11-11 10:26:41 +08:00
parent 3fa0945116
commit 3fd8ba864a
2 changed files with 10 additions and 2 deletions

View File

@ -335,7 +335,15 @@ func InstallPrivoxy() {
} }
} }
let userConfigPath = homeDir + USER_CONFIG_DIR + "user-privoxy.config" let userConfigDir = homeDir + USER_CONFIG_DIR
// Make dir: '~/.ShadowsocksX-NG'
if !fileMgr.fileExists(atPath: userConfigDir) {
try! fileMgr.createDirectory(atPath: userConfigDir
, withIntermediateDirectories: true, attributes: nil)
}
// Install empty `user-privoxy.config` file.
let userConfigPath = userConfigDir + "user-privoxy.config"
if !fileMgr.fileExists(atPath: userConfigPath) { if !fileMgr.fileExists(atPath: userConfigPath) {
let srcPath = Bundle.main.path(forResource: "user-privoxy", ofType: "config")! let srcPath = Bundle.main.path(forResource: "user-privoxy", ofType: "config")!
try! fileMgr.copyItem(atPath: srcPath, toPath: userConfigPath) try! fileMgr.copyItem(atPath: srcPath, toPath: userConfigPath)

View File

@ -36,7 +36,7 @@ func SyncPac() {
} }
let fileMgr = FileManager.default let fileMgr = FileManager.default
if !fileMgr.fileExists(atPath: PACRulesDirPath) { if !fileMgr.fileExists(atPath: PACFilePath) {
needGenerate = true needGenerate = true
} }