From 6ae9d434faf48b8dfb3140d64246a5cf69592b1a Mon Sep 17 00:00:00 2001 From: Matt Baer Date: Mon, 31 Jul 2017 19:14:08 -0400 Subject: [PATCH] Use draft.txt in ~/.writeas folder --- writeas/ViewController.swift | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/writeas/ViewController.swift b/writeas/ViewController.swift index 95d8d07..0f11b73 100644 --- a/writeas/ViewController.swift +++ b/writeas/ViewController.swift @@ -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() {