Fix Bundle Path logic

This commit is contained in:
qinyuhang
2017-01-10 14:49:26 +08:00
parent ff41dbb2fa
commit 6fc13af5fe
+2 -2
View File
@@ -137,7 +137,7 @@ class ServerProfileManager: NSObject {
//读取example文件,删掉configs里面的配置,再用NSDictionary填充到configs里面
let fileManager = FileManager.default
let filePath:String = Bundle.main.bundlePath + "/Contents/Resources/example-gui-config.json"
let filePath:String = Bundle.main.path(forResource: "example-gui-config", ofType: "json")!
let data = fileManager.contents(atPath: filePath)
let readString = NSString(data: data!, encoding: String.Encoding.utf8.rawValue)!
let readStringData = readString.data(using: String.Encoding.utf8.rawValue)
@@ -196,7 +196,7 @@ class ServerProfileManager: NSObject {
class func showExampleConfigFile() {
//copy file to ~/Downloads folder
let filePath:String = Bundle.main.bundlePath + "/Contents/Resources/example-gui-config.json"
let filePath:String = Bundle.main.path(forResource: "example-gui-config", ofType: "json")!
let fileMgr = FileManager.default
let dataPath = NSHomeDirectory() + "/Downloads"
let destPath = dataPath + "/example-gui-config.json"