Use draft.txt in ~/.writeas folder
This commit is contained in:
parent
7539da8e1f
commit
6ae9d434fa
@ -12,7 +12,7 @@ class ViewController: NSViewController, NSTextViewDelegate, NSUserNotificationCe
|
|||||||
|
|
||||||
@IBOutlet var writerText: NSTextView!
|
@IBOutlet var writerText: NSTextView!
|
||||||
|
|
||||||
let draftFile = "Write.as/draft.txt"
|
let draftFile = "\(NSHomeDirectory())/.writeas/draft.txt"
|
||||||
|
|
||||||
override func viewDidLoad() {
|
override func viewDidLoad() {
|
||||||
super.viewDidLoad()
|
super.viewDidLoad()
|
||||||
@ -56,13 +56,7 @@ class ViewController: NSViewController, NSTextViewDelegate, NSUserNotificationCe
|
|||||||
}
|
}
|
||||||
|
|
||||||
fileprivate func getDraftPath() -> URL? {
|
fileprivate func getDraftPath() -> URL? {
|
||||||
do {
|
return URL(fileURLWithPath: draftFile)
|
||||||
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
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func saveDocument() {
|
func saveDocument() {
|
||||||
|
Loading…
Reference in New Issue
Block a user