patch 8.2.4082: check for autoload file name and prefix fails
Problem: Check for autoload file name and prefix fails. (Christian J.
Robinson)
Solution: Only lower case the prefix on systems where the file name is not
case sensitive.
diff --git a/src/scriptfile.c b/src/scriptfile.c
index 56186ff..0d39f38 100644
--- a/src/scriptfile.c
+++ b/src/scriptfile.c
@@ -2156,7 +2156,11 @@
if (p == NULL)
return NULL;
+#ifdef CASE_INSENSITIVE_FILENAME
prefix = strlow_save(p);
+#else
+ prefix = vim_strsave(p);
+#endif
if (prefix == NULL)
return NULL;
diff --git a/src/testdir/test_vim9_import.vim b/src/testdir/test_vim9_import.vim
index 922bd3d..e9d9473 100644
--- a/src/testdir/test_vim9_import.vim
+++ b/src/testdir/test_vim9_import.vim
@@ -1375,6 +1375,31 @@
&rtp = save_rtp
enddef
+" test using a autoloaded file that is case sensitive
+def Test_vim9_autoload_case_sensitive()
+ var lines =<< trim END
+ vim9script autoload
+ export def CaseSensitive(): string
+ return 'done'
+ enddef
+ END
+
+ mkdir('Xdir/autoload', 'p')
+ writefile(lines, 'Xdir/autoload/CaseSensitive.vim')
+ var save_rtp = &rtp
+ exe 'set rtp^=' .. getcwd() .. '/Xdir'
+
+ lines =<< trim END
+ vim9script
+ import autoload 'CaseSensitive.vim'
+ assert_equal('done', CaseSensitive.CaseSensitive())
+ END
+ CheckScriptSuccess(lines)
+
+ delete('Xdir', 'rf')
+ &rtp = save_rtp
+enddef
+
" This was causing a crash because suppress_errthrow wasn't reset.
def Test_vim9_autoload_error()
var lines =<< trim END
diff --git a/src/version.c b/src/version.c
index 67a258a..2a2c3de 100644
--- a/src/version.c
+++ b/src/version.c
@@ -751,6 +751,8 @@
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 4082,
+/**/
4081,
/**/
4080,