Browse Source

Use draft.txt in ~/.writeas folder

master
Matt Baer 4 years ago
parent
commit
6ae9d434fa
1 changed files with 2 additions and 8 deletions
  1. +2
    -8
      writeas/ViewController.swift

+ 2
- 8
writeas/ViewController.swift 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() {


Loading…
Cancel
Save