Mercurial > vim
changeset 975:f88008797313 v7.0.101
updated for version 7.0-101
author | vimboss |
---|---|
date | Tue, 12 Sep 2006 20:25:24 +0000 |
parents | ed44c1c436d3 |
children | 727ab557c58a |
files | src/spell.c src/version.c |
diffstat | 2 files changed, 13 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/src/spell.c +++ b/src/spell.c @@ -9347,20 +9347,27 @@ spell_add_word(word, len, bad, idx, undo fclose(fd); } } - else + + if (!undo) { fd = mch_fopen((char *)fname, "a"); if (fd == NULL && new_spf) { + char_u *p; + /* We just initialized the 'spellfile' option and can't open the * file. We may need to create the "spell" directory first. We * already checked the runtime directory is writable in * init_spellfile(). */ - if (!dir_of_file_exists(fname)) - { + if (!dir_of_file_exists(fname) && (p = gettail_sep(fname)) != fname) + { + int c = *p; + /* The directory doesn't exist. Try creating it and opening * the file again. */ - vim_mkdir(NameBuff, 0755); + *p = NUL; + vim_mkdir(fname, 0755); + *p = c; fd = mch_fopen((char *)fname, "a"); } }