Mercurial > vim
diff src/misc1.c @ 29371:f8b07c537036 v9.0.0028
patch 9.0.0028: MS-Windows: tests fail if there is a "runtime" directory
Commit: https://github.com/vim/vim/commit/022f9ef16c955d6b5fca0f53b79899c56a3966c5
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Jul 2 17:36:31 2022 +0100
patch 9.0.0028: MS-Windows: tests fail if there is a "runtime" directory
Problem: MS-Windows: tests fail if there is a stray "runtime" directory.
Solution: Only use a "runtime" directory if it contains "defaults.vim".
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 02 Jul 2022 18:45:02 +0200 |
parents | b1304512c036 |
children | 057c26b5c33a |
line wrap: on
line diff
--- a/src/misc1.c +++ b/src/misc1.c @@ -1655,7 +1655,21 @@ vim_version_dir(char_u *vimdir) vim_free(p); p = concat_fnames(vimdir, (char_u *)RUNTIME_DIRNAME, TRUE); if (p != NULL && mch_isdir(p)) - return p; + { + char_u *fname = concat_fnames(p, (char_u *)"defaults.vim", TRUE); + + // Check that "defaults.vim" exists in this directory, to avoid picking + // up a stray "runtime" directory, it would make many tests fail in + // mysterious ways. + if (fname != NULL) + { + int exists = file_is_readable(fname); + + vim_free(fname); + if (exists) + return p; + } + } vim_free(p); return NULL; }