From 06f7a36d5fa444d15b3b66799b547cac57d9abc7 Mon Sep 17 00:00:00 2001 From: mitchell <70453897+667e-11@users.noreply.github.com> Date: Sun, 24 May 2020 13:16:05 -0400 Subject: Always use capital drive letters when opening files in Windows. Since Windows filenames are case-insensitive, mismatched drive letter case may cause the same file to be open twice. --- core/lfs_ext.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'core') diff --git a/core/lfs_ext.lua b/core/lfs_ext.lua index 59318da8..abf74dc0 100644 --- a/core/lfs_ext.lua +++ b/core/lfs_ext.lua @@ -124,7 +124,9 @@ end function lfs.abspath(filename, prefix) assert_type(filename, 'string', 1) assert_type(prefix, 'string/nil', 2) - if WIN32 then filename = filename:gsub('/', '\\') end + if WIN32 then + filename = filename:gsub('/', '\\'):gsub('^%l:[/\\]', string.upper) + end if not filename:find(not WIN32 and '^/' or '^%a:[/\\]') and not (WIN32 and filename:find('^\\\\')) then if not prefix then prefix = lfs.currentdir() end -- cgit v1.2.3