diff options
author | dhasenan <dhasenan@gmail.com> | 2018-04-30 20:41:53 -0700 |
---|---|---|
committer | dhasenan <dhasenan@gmail.com> | 2018-04-30 20:46:36 -0700 |
commit | 0d8deb59afda2a03a28f9144d81f1ae62c4813ea (patch) | |
tree | 028cb0e3f7af405b638cc60ef9789c6b23ae5c5e /src/main.c | |
parent | b9f6dfd77e420a068038be828a6e9fb40528346d (diff) |
Don't clobber startup message w/ err opening file
When we opened a file with an unrecognized extension, this was reported
as the same type of failure as if you had specified a file that didn't
exist. The "this is a new file" message clobbered the "failed to read
this file" message.
Fixes #250
Diffstat (limited to 'src/main.c')
-rw-r--r-- | src/main.c | 12 |
1 files changed, 10 insertions, 2 deletions
@@ -560,8 +560,16 @@ void load_sc() { if (c) sprintf(word + strlen(word), " "); sprintf(word + strlen(word), "%s", p.we_wordv[c]); } - if (strlen(word) && ! readfile(word, 0) && ! atoi((char *) get_conf_value("nocurses"))) { - sc_info("New file: \"%s\"", word); // file passed to scim executable does not exists + if (strlen(word) != 0) { + sc_readfile_result result = readfile(word, 0); + if (!atoi((char *) get_conf_value("nocurses"))) { + if (result == SC_READFILE_DOESNTEXIST) { + // It's a new record! + sc_info("New file: \"%s\"", word); + } else if (result == SC_READFILE_ERROR) { + sc_info("\"%s\" is not a SC-IM compatible file", word); + } + } } wordfree(&p); return; |