Use draft.txt in ~/.writeas folder

This commit is contained in:
Matt Baer 2017-07-31 19:14:08 -04:00
parent 7539da8e1f
commit 6ae9d434fa

View File

@ -12,7 +12,7 @@ class ViewController: NSViewController, NSTextViewDelegate, NSUserNotificationCe
@IBOutlet var writerText: NSTextView!
let draftFile = "Write.as/draft.txt"
let draftFile = "\(NSHomeDirectory())/.writeas/draft.txt"
override func viewDidLoad() {
super.viewDidLoad()
@ -56,13 +56,7 @@ class ViewController: NSViewController, NSTextViewDelegate, NSUserNotificationCe
}
fileprivate func getDraftPath() -> URL? {
do {
let baseDir = try FileManager.default.url(for: .documentDirectory, in: .allDomainsMask, appropriateFor: nil, create: true)
return baseDir.appendingPathComponent(draftFile)
} catch (let err) {
print("ERROR getting path: \(err)")
return nil
}
return URL(fileURLWithPath: draftFile)
}
func saveDocument() {