diff options
| author | Marc André Tanner <mat@brain-dump.org> | 2014-09-12 14:19:11 +0200 |
|---|---|---|
| committer | Marc André Tanner <mat@brain-dump.org> | 2014-09-12 14:19:11 +0200 |
| commit | 7e0a214aae6bb7e91c2711f9e90db5fe146dd9d7 (patch) | |
| tree | d65f35cffadeaae998477c8171a3ec28679f1fda /editor.c | |
| parent | 0ca2d7ab6883abadb244a452525d59ce6d324f82 (diff) | |
| download | vis-7e0a214aae6bb7e91c2711f9e90db5fe146dd9d7.tar.gz vis-7e0a214aae6bb7e91c2711f9e90db5fe146dd9d7.tar.xz | |
Fix loading of not yet existing files
Diffstat (limited to 'editor.c')
| -rw-r--r-- | editor.c | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -1,6 +1,7 @@ #define _BSD_SOURCE #include <stdlib.h> #include <string.h> +#include <unistd.h> #include "editor.h" #include "util.h" @@ -305,9 +306,11 @@ static EditorWin *editor_window_new_text(Editor *ed, Text *text) { } bool editor_window_new(Editor *ed, const char *filename) { - Text *text = text_load(filename); + Text *text = text_load(filename && access(filename, R_OK) == 0 ? filename : NULL); if (!text) return false; + if (filename) + text_filename_set(text, filename); EditorWin *win = editor_window_new_text(ed, text); if (!win) { |
